知道时间的格式,如Y-m-d或Y年m月d日如何将此形式的值转换回unix时间戳呢?

解决方案 »

  1.   

    日期转unix时间戳 [复制]<?php
    echo mktime (19,18,41,2,9,2006);//小时, 分, 秒, 月, 天, 年
    //2004-10-9-20:11:36
    ?>在网上google一下嘛。
      

  2.   

    这个我知道。
    2009年04月26日 17:38:52
    格式为Y年m月d日,同时,这个格式有可能会变化,会变成y-m-d或其它怎么根据这个格式把日期还原成unix时间戳。mktime必须是固定的格式
      

  3.   

    用 strtotime 函数
    不过不支持 中文格式 2009年04月26日 17:38:52 
      

  4.   

    $str = '2009年04月26日 17:38:52';$str = str_replace(array("年","月","日","时","分","秒"),array("-","-","",":",":",""),$str);echo strtotime($str);