Python 日期格式代码
日期格式代码
所有合法格式代码的参考:
指令 | 描述 | 实例 | 试一试 |
---|---|---|---|
%a | Weekday, short version | Wed | 亲自试一试 » |
%A | Weekday, full version | Wednesday | 亲自试一试 » |
%w | Weekday as a number 0-6, 0 is Sunday | 3 | 亲自试一试 » |
%d | Day of month 01-31 | 31 | 亲自试一试 » |
%b | Month name, short version | Dec | 亲自试一试 » |
%B | Month name, full version | December | 亲自试一试 » |
%m | Month as a number 01-12 | 12 | 亲自试一试 » |
%y | Year, short version, without century | 18 | 亲自试一试 » |
%Y | Year, full version | 2018 | 亲自试一试 » |
%H | Hour 00-23 | 17 | 亲自试一试 » |
%I | Hour 00-12 | 05 | 亲自试一试 » |
%p | AM/PM | PM | 亲自试一试 » |
%M | Minute 00-59 | 41 | 亲自试一试 » |
%S | Second 00-59 | 08 | 亲自试一试 » |
%f | Microsecond 000000-999999 | 548513 | 亲自试一试 » |
%z | UTC offset | +0100 | |
%Z | Timezone | CST | |
%j | Day number of year 001-366 | 365 | 亲自试一试 » |
%U | Week number of year, Sunday as the first day of week, 00-53 | 52 | 亲自试一试 » |
%W | Week number of year, Monday as the first day of week, 00-53 | 52 | 亲自试一试 » |
%c | Local version of date and time | Mon Dec 31 17:41:00 2018 | 亲自试一试 » |
%x | Local version of date | 12/31/18 | 亲自试一试 » |
%X | Local version of time | 17:41:00 | 亲自试一试 » |
%% | A % character | % | 亲自试一试 » |