<?php
$data='20051231';//2005-12-31 符合标准的日期格式
echo strtotime($data);
?>
1135958400 就会自己转。
这个作用一般是用来做时间运算,比如转成UNIX值后,再通过DATE还原成你想要的时间格式。
例如:
20050101加15天得到的日期是多少,可通过
echo date("Ymd",(strtotime('20050101')+15*24*3600))来获得。

解决方案 »

  1.   

    int strtotime ( string time [, int now])
    本函数预期接受一个包含英文日期格式的字符串并尝试将其解析为 UNIX 时间戳。
    例子  strtotime() 例子<?php
    echo strtotime ("now"), "\n";
    echo strtotime ("10 September 2000"), "\n";
    echo strtotime ("+1 day"), "\n";
    echo strtotime ("+1 week"), "\n";
    echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n";
    echo strtotime ("next Thursday"), "\n";
    echo strtotime ("last Monday"), "\n";
    ?>