mysql date format

mysql date and character conversion method
date_format(date,'%Y-%m-%d')    -------------->oracle中的to_char();
str_to_date(date,'%Y-%m-%d')     -------------->oracle中的to_date();
 
%Y: represents a 4-digit year
%y: represents the year of 2
 
%m: represents month, the format is (01...12)  
%c: represents month, the format is (1...12)
 
%d: represents the number of days in the month, the format is (00...31)  
%e: represents the number of days in the month, the format is (0...31) 
 
%H: represents the hour, the format is (00...23)  
%k: represents the hour, the format is (0...23)  
%h: represents the hour, the format is (01...12)  
%I: represents the hour, the format is (01...12)  
%l : represents the hour, the format is (1...12)
  
%i: Represents minutes, the format is (00...59) 
 
%r: represents time, the format is 12 hours (hh:mm:ss [AP]M)  
%T: represents time, the format is 24 hours (hh:mm:ss) 
 
%S: stands for seconds, the format is (00...59)  
%s: represents seconds, the format is (00...59)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326898462&siteId=291194637