Django Book 翻译
菜单>:
TOC
返回
原文:
.. table:: Table F-2. Available Date Format Strings +---------+--------------------------------------------------------+--------------+ |Format |Description |Example Output| |Character| | | +=========+========================================================+==============+ |a |``'a.m.'`` or ``'p.m.'`` . (Note that this is slightly |``'a.m.'`` | | |different from PHPs output, because this includes | | | |periods to match Associated Press style.) | | +---------+--------------------------------------------------------+--------------+ |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 |``'1'`` , | | |off if theyre zero. |``'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 |``'1 a.m.'`` ,| | |minutes left off if theyre zero and the special-case |``'1:30 | | |strings ``'midnight'`` and ``'noon'`` if appropriate. |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 |``'st'`` , | | |characters. |``'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 |``1`` , ``23``| | |Monday. | | +---------+--------------------------------------------------------+--------------+ |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 |``-43200`` to | | |west of UTC is always negative, and for those east of |``43200`` | | |UTC it is always positive. | | +---------+--------------------------------------------------------+--------------+
翻译:
.. table:: 表F-2. 可用的日期格式字符串 +---------+--------------------------------------------------------+--------------+ |格式字符 |描述 |示例输出 | |串 | | | +=========+========================================================+==============+ |a |``'a.m.'`` 或者 ``'p.m.'`` 。(这与PHP中的输出略有不同,|``'a.m.'`` | | |因为为了匹配美联社风格,它包含了句点。 | | +---------+--------------------------------------------------------+--------------+ |A |``'AM'`` 或者 ``'PM'`` 。 |``'AM'`` | +---------+--------------------------------------------------------+--------------+ |b |月份,文字式的,三个字母,小写。 |``'jan'`` | +---------+--------------------------------------------------------+--------------+ |d |一月的第几天,两位数字,带前导零。 |``'01'`` 到 | | | |``'31'`` | +---------+--------------------------------------------------------+--------------+ |D |一周的第几天,文字式的,三个字母。 |``'Fri'`` | +---------+--------------------------------------------------------+--------------+ |f |时间,12小时制的小时和分钟数,如果分钟数为零则不显示。 |``'1'`` , | | | |``'1:30'`` | +---------+--------------------------------------------------------+--------------+ |F |月份,文字式的,全名。 |``'January'`` | +---------+--------------------------------------------------------+--------------+ |g |小时,12小时制,没有前导零。 |``'1'`` 到 | | | |``'12'`` | +---------+--------------------------------------------------------+--------------+ |G |小时,24小时制,没有前导零。 |``'0'`` 到 | | | |``'23'`` | +---------+--------------------------------------------------------+--------------+ |h |小时,12小时制。 |``'01'`` 到 | | | |``'12'`` | +---------+--------------------------------------------------------+--------------+ |H |小时,24小时制。 |``'00'`` 到 | | | |``'23'`` | +---------+--------------------------------------------------------+--------------+ |i |分钟。 |``'00'`` 到 | | | |``'59'`` | +---------+--------------------------------------------------------+--------------+ |j |一月的第几天,不带前导零。 |``'1'`` 到 | | | |``'31'`` | +---------+--------------------------------------------------------+--------------+ |l |一周的第几天,文字式的,全名。 |``'Friday'`` | +---------+--------------------------------------------------------+--------------+ |L |是否为闰年的布尔值。 |``True`` 到 | | | |``False`` | +---------+--------------------------------------------------------+--------------+ |m |月份,两位数字,带前导零。 |``'01'`` 到 | | | |``'12'`` | +---------+--------------------------------------------------------+--------------+ |M |月份,文字式的,三个字母。 |``'Jan'`` | +---------+--------------------------------------------------------+--------------+ |n |月份,没有前导零。 |``'1'`` 到 | | | |``'12'`` | +---------+--------------------------------------------------------+--------------+ |N |美联社风格的月份缩写。 |``'Jan.'`` , | | | |``'Feb.'`` , | | | |``'March'`` , | | | |``'May'`` | +---------+--------------------------------------------------------+--------------+ |O |与格林威治标准时间的时间差(以小时计)。 |``'+0200'`` | +---------+--------------------------------------------------------+--------------+ |P |时间,12小时制的小时分钟数以及a.m./p.m.,分钟数如果为零 |``'1 a.m.'`` ,| | |则不显示,用字符串表示特殊时间点,如 ``'midnight'`` 和 |``'1:30 | | |``'noon'`` 。 |p.m.'`` , | | | |``'midnight'``| | | |, ``'noon'`` ,| | | |``'12:30 | | | |p.m.'`` | +---------+--------------------------------------------------------+--------------+ |r |RFC 822 格式的日期。 |``'Thu, 21 Dec| | | |2000 16:01:07 | | | |+0200'`` | +---------+--------------------------------------------------------+--------------+ |s |秒数,两位数字,带前导零。 |``'00'`` 到 | | | |``'59'`` | +---------+--------------------------------------------------------+--------------+ |S |英语序数后缀,用于表示一个月的第几天,两个字母。 |``'st'`` , | | | |``'nd'`` , | | | |``'rd'`` 到 | | | |``'th'`` | +---------+--------------------------------------------------------+--------------+ |t |指定月份的天数。 |``28`` 到 | | | |``31`` | +---------+--------------------------------------------------------+--------------+ |T |本机的时区。 |``'EST'`` , | | | |``'MDT'`` | +---------+--------------------------------------------------------+--------------+ |w |一周的第几天,数字,带前导零。 |``'0'`` | | | |(Sunday) 到 | | | |``'6'`` | | | |(Saturday) | +---------+--------------------------------------------------------+--------------+ |W |ISO-8601 一年中的第几周,一周从星期一开始。 |``1`` , ``23``| +---------+--------------------------------------------------------+--------------+ |y |年份,两位数字。 |``'99'`` | +---------+--------------------------------------------------------+--------------+ |Y |年份,四位数字。 |``'1999'`` | +---------+--------------------------------------------------------+--------------+ |z |一年的第几天。 |``0`` 到 | | | |``365`` | +---------+--------------------------------------------------------+--------------+ |Z |以秒计的时区偏移量,这个偏移量对于UTC西部时区总是负数, |``-43200`` 到 | | |对于UTC东部时区总是正数。 |``43200`` | +---------+--------------------------------------------------------+--------------+
备注:
译者: