zoukankan      html  css  js  c++  java
  • mysql str_to_date 字符串转换为日期

    1.mysql日期和字符相互转换方法 
    date_format(date,’%Y-%m-%d’) ————–>oracle中的to_char(); 
    str_to_date(date,’%Y-%m-%d’) ————–>oracle中的to_date();

    %Y:代表4位的年份 
    %y:代表2为的年份

    %m:代表月, 格式为(01……12) 
    %c:代表月, 格式为(1……12)

    %d:代表月份中的天数,格式为(00……31) 
    %e:代表月份中的天数, 格式为(0……31)

    %H:代表小时,格式为(00……23) 
    %k:代表 小时,格式为(0……23) 
    %h: 代表小时,格式为(01……12) 
    %I: 代表小时,格式为(01……12) 
    %l :代表小时,格式为(1……12)

    %i: 代表分钟, 格式为(00……59) 【只有这一个代表分钟,大写的I 不代表分钟代表小时】

    %r:代表 时间,格式为12 小时(hh:mm:ss [AP]M) 
    %T:代表 时间,格式为24 小时(hh:mm:ss)

    %S:代表 秒,格式为(00……59) 
    %s:代表 秒,格式为(00……59)

    2.例子: 
    select str_to_date(‘09/01/2009’,’%m/%d/%Y’)

    select str_to_date(‘20140422154706’,’%Y%m%d%H%i%s’)

    select str_to_date(‘2014-04-22 15:47:06’,’%Y-%m-%d %H:%i:%s’)

     转自:https://www.cnblogs.com/feiwenstyle/p/9531571.html
  • 相关阅读:
    正则表达式() [] {}区别
    JAVA int自动装箱
    Intellij Idea debug 远程部署的的tomcat项目
    TensorFlow MNIST CNN 代码
    线性代数-01-向量究竟是什么
    线性代数-线性代数的本质
    TensorFlow MNIST 入门 代码
    TensorFlow 学习可视化 TensorBoard 简易教程
    TensorFlow 函数
    TensorFlow Demo2
  • 原文地址:https://www.cnblogs.com/javalinux/p/15044295.html
Copyright © 2011-2022 走看看