mysql unix finds the specified date data code in the quasi time format

  • 2020-06-15 10:24:13
  • OfStack

 
select * from table where DATE_FORMAT(FROM_UNIXTIME(createtime),'%Y-%m-%d')='2014-01-02' 

FROM_UNIXTIME USES the syntax

FROM_UNIXTIME(unix_timestamp,format)
FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format) is the time function in MySQL
,unix_timestamp can be the field name or just the Unix time. format mainly formats the return value.
If format has been given, the format of the result is based on the format string.
Returns 1 string representing the Unix time token, formatted according to the format string. format can contain the same modifier as the entry listed by the DATE_FORMAT() function.
Format the date value according to the format string.
The following modifiers can be used in the format string:
Name of the month) December)
Name of the Week) Saturday)
%D date of month with English prefix (1st, 2nd, 3rd, etc.)
Years, number, 4
%y, number, two
The abbreviated name of the week (Sun... Sat)
Number of days in the month (00...... 31)
Number of days in a month, number (0... 31)
Month, number (01... 12)
Month, number (1... 12)
The abbreviation for the month (Jan... Dec)
Days in a year (001... 366).
% (00 H hours... 23)
% k hours (0... 23)
% (01 h hours... 12)
% (01 I hours... 12)
% l hours (1... 12)
%i minutes, number (00... 59)
%r time,12 hours (hh:mm:ss [AP]M)
%T time,24 hours (hh:mm:ss)
% (00 S seconds... 59)
% (00 s seconds... 59)
% p AM or PM
Days of the week (0=Sunday... 6 = Saturday)
% (0 U week... Sunday is the first day of The week here
% (0 u week... Monday is the first day of the week here
%% 1 text '%'

Related articles: