Django 模板日期格式表 博客分类: Django django
程序员文章站
2024-03-21 11:44:10
...
Format Character | Description | Example Output |
a | 'a.m.' or 'p.m.' . (Note that this is slightly different from PHPs output, because this includes periods to match Associated Press style.) | 'a.m.' |
A | 'AM' or 'PM' . | 'AM' |
b | Month, textual, three letters, lowercase | 'jan' |
d | Day of the month, two digits with leading zeros. | '01' to '31' |
D | Day of the week, textual, three letters. | 'Fri' |
f | Time, in 12-hour hours and minutes, with minutes left off if theyre zero. | '1' , '1:30' |
F | Month, textual, long. | 'January' |
g | Hour, 12-hour format without leading zeros. | '1' to '12' |
G | Hour, 24-hour format without leading zeros. | '0' to '23' |
h | Hour, 12-hour format. | '01' to '12' |
H | Hour, 24-hour format. | '00' to '23' |
i | Minutes. | '00' to '59' |
j | Day of the month without leading zeros. | '1' to '31' |
l | Day of the week, textual, long. | 'Friday' |
L | Boolean for whether its a leap year. | True or False |
m | Month, two digits with leading zeros. | '01' to '12' |
M | Month, textual, three letters. | 'Jan' |
n | Month without leading zeros. | '1' to '12' |
N | Month abbreviation in Associated Press style. | 'Jan.' , 'Feb.' , 'March' , 'May' |
O | Difference to Greenwich Mean Time in hours. | '+0200' |
P | Time, in 12-hour hours, minutes, and a.m./p.m., with minutes left off if theyre zero and the special-case strings 'midnight' and 'noon' if appropriate. | '1 a.m.' , '1:30 p.m.' , 'midnight', 'noon' , '12:30 p.m.' |
r | RFC 822 formatted date. | 'Thu, 21 Dec 2000 16:01:07 +0200' |
s | Seconds, two digits with leading zeros. | '00' to '59' |
S | English ordinal suffix for day of the month, two characters. | 'st' , 'nd' , 'rd' or 'th' |
t | Number of days in the given month. | 28 to 31 |
T | Time zone of this machine. | 'EST' , 'MDT' |
w | Day of the week, digits without leading zeros. | '0' (Sunday) to '6' (Saturday) |
W | ISO-8601 week number of year, with weeks starting on Monday. | 1 , 23 |
y | Year, two digits. | '99' |
Y | Year, four digits. | '1999' |
z | Day of the year. | 0 to 365 |
Z | Time zone offset in seconds. The offset for time zones west of UTC is always negative, and for those east of UTC it is always positive. |
推荐阅读
-
Django template 过滤器 博客分类: Django djangopython
-
Django 模板日期格式表 博客分类: Django django
-
sae上django项目的数据库配置 博客分类: python djangosae
-
Windows下Python+django+mysql 博客分类: django Djangosaepython
-
大家可以抛弃Java踹死Django转投Rails的怀抱了! 博客分类: Ruby RailsDjangoJavaGrailsStruts
-
django-blog(二)设置mysql数据库并创建模型 博客分类: django
-
django-blog(五)admin后台配置 博客分类: django
-
django分页 博客分类: python
-
django-blog(一) 博客分类: django
-
django-blog(六)自定义富媒体 博客分类: django