$date
, string $format
) : array
strptime() 锟斤拷锟斤拷一锟斤拷锟斤拷
date
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷椋拷锟斤拷锟斤拷锟斤拷锟斤拷 FALSE
锟斤拷
锟铰份猴拷锟斤拷锟节硷拷锟斤拷锟斤拷锟斤拷锟皆硷拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟叫关碉拷锟街凤拷锟斤拷锟斤拷应锟斤拷
setlocale()锟借定锟侥碉拷前锟斤拷锟斤拷LC_TIME
锟斤拷锟斤拷
date
锟斤拷string锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟� strftime() 锟斤拷锟截的o拷
format
锟斤拷string锟斤拷
date
锟斤拷使锟矫的革拷式锟斤拷锟斤拷锟斤拷同
strftime() 锟斤拷锟斤拷使锟矫碉拷锟斤拷同锟斤拷锟斤拷
锟斤拷锟斤拷锟叫关革拷式选锟斤拷锟斤拷锟较拷锟� strftime() 页锟芥。
锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE
锟斤拷锟斤拷 | 说锟斤拷 |
---|---|
tm_sec | 锟斤拷前锟斤拷锟斤拷锟节碉拷锟斤拷锟斤拷锟斤拷0-61锟斤拷 |
tm_min | 锟斤拷前小时锟节的凤拷锟斤拷锟斤拷锟斤拷0-59锟斤拷 |
tm_hour | 锟斤拷夜锟斤拷锟叫∈憋拷锟斤拷锟�0-23锟斤拷 |
tm_mday | 锟铰凤拷锟叫的第硷拷锟届(1-31锟斤拷 |
tm_mon | 锟斤拷一锟斤拷锟斤拷锟斤拷思锟斤拷锟斤拷拢锟�0-11锟斤拷 |
tm_year | 锟斤拷 1900 锟斤拷锟斤拷锟斤拷思锟斤拷锟� |
tm_wday | 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷思锟斤拷欤�0-6锟斤拷 |
tm_yday | 锟斤拷锟斤拷锟斤拷一锟斤拷一锟斤拷锟斤拷锟斤拷硕锟斤拷锟斤拷欤�0-365锟斤拷 |
unparsed | date 锟斤拷未锟斤拷通锟斤拷指锟斤拷锟斤拷
format 识锟斤拷牟锟斤拷锟� |
Example #1 strptime() 锟斤拷锟斤拷
<?php
$format = '%d/%m/%Y %H:%M:%S';
$strf = strftime($format);
echo "$strf\n";
print_r(strptime($strf, $format));
?>
锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�
03/10/2004 15:54:19 Array ( [tm_sec] => 19 [tm_min] => 54 [tm_hour] => 15 [tm_mday] => 3 [tm_mon] => 9 [tm_year] => 104 [tm_wday] => 0 [tm_yday] => 276 [unparsed] => )
Note: 锟剿猴拷锟斤拷未锟斤拷 Windows 平台锟斤拷实锟街★拷
Note:
Internally, this function calls the strptime() function provided by the system's C library. This function can exhibit noticeably different behaviour across different operating systems. The use of date_parse_from_format(), which does not suffer from these issues, is recommended on PHP 5.3.0 and later.
Note:
"tm_sec" includes any leap seconds (currently upto 2 a year). For more information on leap seconds, see the » Wikipedia article on leap seconds.
Note:
Prior to PHP 5.2.0, this function could return undefined behaviour. Notably, the "tm_sec", "tm_min" and "tm_hour" entries would return undefined values.