MySQL中时间格式化函数DATE_FORMAT(date,format)中标识符含义
| 标识符 | 描述 | 解释 |
|---|---|---|
| %a | Abbreviated weekday name (Sun…Sat) | 缩写的周一到周天 |
| %b | Abbreviated month name (Jan…Dec) | 缩写的一月到十二月 |
| %c | Month, numeric (0…12) | 一位数的一月到十二月 |
| %D | Day of the month with English suffix (0th, 1st, 2nd, 3rd, …) | 带有英文后缀的月份日期 |
| %d | Day of the month, numeric (00…31) | 两位数的月份日期 |
| %e | Day of the month, numeric (0…31) | 一位数的月份日期 |
| %f | Microseconds (000000…999999) | 微秒 |
| %H | Hour (00…23) | 两位数的24小时 |
| %h | Hour (01…12) | 两位数的12小时 |
| %I | Hour (01…12) | 两位数的12小时 |
| %i | Minutes, numeric (00…59) | 两位数的分钟数 |
| %j | Day of year (001…366) | 三位数的年份天数 |
| %k | Hour (0…23) | 两位数的24小时 |
| %l | Hour (1…12) | 两位数的12小时 |
| %M | Month name (January…December) | 英文的一月到十二月 |
| %m | Month, numeric (00…12) | 两位数的一月到十二月 |
| %p | AM or PM | 英文的上午或下午 |
| %r | Time, 12-hour (hh:mm:ss followed by AM or PM) | 带有AM或PM的12小时制时间03:12:53 PM |
| %S | Seconds (00…59) | 秒 |
| %s | Seconds (00…59) | 秒 |
| %T | Time, 24-hour (hh:mm:ss) | 24小时制的时间 15:12:53 |
| %U | Week (00…53), where Sunday is the first day of the week; WEEK() mode 0 | 第多少周,周天为一周的第一天 |
| %u | Week (00…53), where Monday is the first day of the week; WEEK() mode 1 | 第多少周,周一为一周的第一天 |
| %V | Week (01…53), where Sunday is the first day of the week; WEEK() mode 2; used with %X | 第多少周,周天为一周的第一天 |
| %v | Week (01…53), where Monday is the first day of the week; WEEK() mode 3; used with %x | 第多少周,周一为一周的第一天 |
| %W | Weekday name (Sunday…Saturday) | 英文的周一到周天 |
| %w | Day of the week (0=Sunday…6=Saturday) | 数字的周一到周天 0为周天 |
| %X | Year for the week where Sunday is the first day of the week, numeric, four digits; used with %V | 四位数的年份,周天为一周的第一天 |
| %x | Year for the week, where Monday is the first day of the week, numeric, four digits; used with %v | 四位数的年份,周一为一周的第一天 |
| %Y | Year, numeric, four digits | 四位数的年份 |
| %y | Year, numeric (two digits) | 两位数的年份 |
| %% | A literal % character | |
| %x | x, for any “x” not listed above |

