mySql使用手冊-官方文檔

https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-formathtml

oracle to_char()to_date()函數 mysql日期和字符相互轉換方法

mysql 相似to_char() to_date()函數
  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)
  %r:表明 時間,格式爲12 小時(hh:mm:ss [AP]M)
  %T:表明 時間,格式爲24 小時(hh:mm:ss)
  %S:表明 秒,格式爲(00……59)
  %s:表明 秒,格式爲(00……59)
  SELECT DATE_FORMAT(20130111191640,'%Y-%m-%d %H:%i:%s')
  DATE_FORMAT(20130111191640,'%Y-%m-%d %H:%i:%s')
————————————————
版權聲明:本文爲CSDN博主「coco愛火女」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處連接及本聲明。
原文連接:https://blog.csdn.net/u011424470/article/details/79637978mysql

相關文章
相關標籤/搜索