MYSQL operation on time

Get the current time stamp unix_timestamp (now ());
 
Transfer time stamp unix_timestamp ( '2018-01-15 09:45:16');
 
Rotation time stamp from_unixtime (1515980716); (note, java default time stamp generator is 13, and therefore be divided by the conversion in 1000)
 
Timestamp formatting from_unixtime (1515980716, '% Y-% m-% d% H:% i:% S');
 
Time Format date_format (now (), '% Y-% m-% d'); or date_format ( '2018-01-15 09:45:16', '% Y-% m-% d');
 
The format string formatted date value.
The following modifiers can be used in the format string:
% M month name (January ...... December)
% W week name (Sunday ...... Saturday)
% D dated January English prefix (1st, 2nd, 3rd, and so on.)
% Y Year, numeric, 4
% Y Year, numeric, 2
% A abbreviated weekday name (Sun ...... Sat)
% D number of days in the month, digital (00 ...... 31)
% E number of days in the month, numbers (0 ...... 31)
% M month, numbers (01 ...... 12)
% C month, numbers (1 ...... 12)
% B Abbreviated month name (Jan ...... Dec)
% J all year round basis heaven number (001 ...... 366)
% H hour (00 ...... 23)
% K h (0 ...... 23)
% H hour (01 ...... 12)
% I hour (01 ...... 12)
H% l (1 ...... 12)
% I minutes, digital (00 ...... 59)
% R time, 12 hours (hh: mm: ss [AP] M)
% T time, 24 hours (hh: mm: ss)
% S seconds (00 ...... 59)
% S second (00 ...... 59)
% P AM or PM
% W number of days of the week (0 = Sunday ...... 6 = Saturday)
% U Week (0 ...... 52), where Sunday is the first day of the week
% U Week (0 ...... 52), where Monday is the first day of the week
%% a literal "%."
 
 
 
 
 
 
 
 
 
 

Guess you like

Origin www.cnblogs.com/qiaolingzui/p/11804441.html