文章目录[隐藏]
将字符串
04 April 2014 – 09:00 AM
转化成时间戳
6本文来源gao@dai!ma.com搞$代^码!网7
搞gaodaima代码
strtotime不管用啊
求助~
回复讨论(解决方案)
echo strtotime(’04 April 2014 09:00 AM’);
怎么可能呢?你是怎么写的?
echo strtotime(’04 April 2014 09:00 AM’);
得到结果:1396602000
echo strtotime(’04 April 2014 09:00 AM’);
得到结果:1396602000
中间还有一个断线连接着呢 。。。。。
那是你的日期格式不对,删掉就可以了
echo strtotime(str_replace(‘-‘, ”, ’04 April 2014 – 09:00 AM’)); //1396573200
echo strtotime(’04 April 2014 09:00 AM’);
得到结果:1396602000
中间还有一个断线连接着呢 。。。。。
额,字符串处理问题那。
$str = ’04 April 2014 – 09:00 AM’;
$str1 = explode(“-“,$str);
$str2 = join(” “,$str1);
echo strtotime($str2);
那是你的日期格式不对,删掉就可以了
echo strtotime(str_replace(‘-‘, ”, ’04 April 2014 – 09:00 AM’)); //1396573200
谢谢~