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
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的mysql str_to_date 字符串转换为日期的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Exchange 2016异地容灾系列-
- 下一篇: mysql状态常用参数分析