将字符串
04 April 2014 - 09:00 AM
转化成时间戳
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
谢谢~
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号