strptime

(PHP 5 >= 5.1.0, PHP 7)

strptime������ strftime() ���ɵ����ڣ�ʱ��

˵��

strptime ( string $date , string $format ) : array

strptime() ����һ���� date ����������飬��������� FALSE��

�·ݺ����ڼ��������Լ������������йص��ַ�����Ӧ�� setlocale()�趨�ĵ�ǰ����LC_TIME����

����

date��string��

���������ַ���������� strftime() ���صģ�

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 ʶ��IJ���

����

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.

�μ�