Copy Code code as follows:
SELECT * FROM table where Date_format (From_unixtime (createtime), '%y-%m-%d ') = ' 2014-01-02 '
From_unixtime using syntax
From_unixtime (Unix_timestamp,format)
From_unixtime (Unix_timestamp), From_unixtime (Unix_timestamp,format) is a time function in MySQL
, Unix_timestamp can be a field name, or it can be a Unix time, and format is primarily formatted with the return value.
If format is already given, the format of the result depends on the format string.
Returns a String representing the Unix time token, formatted according to the format string. FORMAT can contain the same modifiers as the entries listed in the Date_format () function.
Formats the date value based on the format string.
The following modifiers can be used in the format string:
%m month name (January ...) December)
%w Week name (Sunday ...) Saturday)
%d The date of the month with English prefix (1st, 2nd, 3rd, and so on). )
%Y years, numbers, 4-bit
%y years, numbers, 2-bit
%a name of the week (Sun ...) Sat)
Days in%d months, numbers (00 ...). 31)
%e the number of days in the month, numbers (0 ...). 31)
%m Month, number (01 ...) 12)
%c month, number (1 ...). 12)
%b abbreviated month name (...) DEC)
%j the number of days in a year (001 ...). 366)
%H hours (00 .....) 23)
%k hours (0 .....) 23)
%h hours (01 .....) 12)
%I Hours (01 .....) 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)
%s seconds (00 ...). 59)
%s seconds (00 ...). 59)
%p am or PM
%w the number of days in one weeks (0=sunday ...). 6=saturday)
%u weeks (0 .....) 52), here Sunday is the first day of the week
%u weeks (0 .....) 52), here Monday is the first day of the week
Percent% of a text "%"