回复 第3楼 的 hujingdj:下面列出一些常见的时间格式.是从林建甫教授的网页中截取
http://web.ntpu.edu.tw/~cflin/
<br />
格式 說明<br />
%a Abbreviated weekday name<br />
%A Full weekday name<br />
%b Abbreviated month name<br />
%B Full month name<br />
%c Date and time, locale-specific.<br />
%d Day of the month as decimal number (01-31).<br />
%H Hours as decimal number (00-23).<br />
%I Hours as decimal number (01-12).<br />
%j Day of year as decimal number (001-366).<br />
%m Month as decimal number (01-12).<br />
%M Minute as decimal number (00-59).<br />
%p AM/PM indicator in the locale.<br />
Used in conjuction with ’%I’ and *not* with ’%H’.<br />
%S Second as decimal number (00-61), allowing for up to two leap-seconds<br />
%U Week of the year as decimal number (00-53)<br />
using the first Sunday as day 1 of week 1.<br />
%w Weekday as decimal number (0-6, Sunday is 0).<br />
%W Week of the year as decimal number (00-53)<br />
using the first Monday as day 1 of week 1.<br />
%x Date, locale-specific.<br />
%X Time, locale-specific.<br />
%y Year without century (00-99).<br />
If you use this on input, which century you get is system-specific. So don’t!<br />
Often values up to 69 (or 68) are prefixed by 20 and 70-99 by 19.<br />
%Y Year with century.<br />
%z (output only.) Offset from Greenwich, so ’-0800’ is 8 hours west of Greenwich.<br />
%Z (output only.) Time zone as a character string (empty if not available).<br />
%F Equivalent to %Y-%m-%d (the ISO 8601 date format).<br />
%g The last two digits of the week-based year (see ’%V’).<br />
%G The week-based year (see ’%V’) as a decimal number.<br />
%u Weekday as a decimal number (1-7, Monday is 1).<br />
%V Week of the year as decimal number (00-53).<br />
If the week (starting on Monday) containing 1 January<br />
has four or more days in the new year, then it is considered week 1.<br />
Otherwise, it is the last week of the previous year,<br />
and the next week is week 1.<br />
%D Locale-specific date format such as ’%m/%d/%y’.<br />
%k The 24-hour clock time with single digits preceded by a blank.<br />
%l The 12-hour clock time with single digits preceded by a blank.<br />
%n Newline on output, arbitrary whitespace on input.<br />
%r The 12-hour clock time (using the locale’s AM or PM).<br />
%R Equivalent to ’%H:%M’.<br />
%t Newline on output, arbitrary whitespace on input.<br />
%T Equivalent to ’%H:%M:%S’.<br />
</p>