Select Date_format (create_time, '%y%u ') weeks,count (Caseid) count from Tc_case Group by weeks; Select Date_format (create_time, '%y%m%d ') days,count (Caseid) count from Tc_case Group by days; Select Date_format (create_time, '%y%m ') months,count (Caseid) count from Tc_case group by months; Date_format (Date,format)
Formats the date value according to 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 prefixes (1st, 2nd, 3rd, etc.). )%Y year, number, 4-bit www.2cto.com%Y year, number, 2-digit%a abbreviated week name (Sun ... Sat)%d days in the month, number (00 ... %e number of days in the month, number (0 ... %m months, numbers (01 ... %c month, number (1 ... %b Abbreviated month name (Jan ... DEC)%j Days of the year (001 ... 366)%H hours (00 ... %k hours (0 ...) %h hours (01 ...) %I) Hours (01 ... %l hours (1 ...) %i minutes, Numbers (00 ...) %r time, 12 hours (Hh:mm:ss [ap]m)%T time, 24 hours (hh:mm:ss)%s seconds (00 ... ()%s seconds (00 ... %p am or PM%w one days of the week (0=sunday ... 6=saturday)%u week (0 ... 52), here Sunday is the first day of the week%u week (0 ... 52), here Monday is the first day of the week with a text "%".
Date_format usage of MySQL