[英]Strtotime Function
I made a script where I put all date informations: day, month, year , hour , minutes and format like AM or PM. 我编写了一个脚本,其中放置了所有日期信息:日,月,年,小时,分钟和格式,例如AM或PM。 Then I take all informations with: 然后,我将获取所有信息:
$day = $_POST['day']
..........
That's how I take all informations and it works well, but when I wanna do: 这就是我获取所有信息的方式,并且效果很好,但是当我想这样做时:
$time = strtotime($hour.':'.$minute.' '.$format.' '.$year.'-'.$month.'-'.$day);
It updates my database with UTC from 1970, actualy first second ever count. 它从1970年开始使用UTC更新我的数据库,实际上是第一秒。
What is wrong? 怎么了?
The H:i A Ymd
is not an acceptable format for strtotime()
. 对于strtotime()
, H:i A Ymd
不是可接受的格式 。 You need to use Ymd H:i A
. 您需要使用Ymd H:i A
$time = strtotime($year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.' '.$format);
Yeah, strtotime works fine now with this format: 是的,strtotime现在可以使用以下格式正常工作:
$time = strtotime($day.'-'.$month.'-'.$year.' '.$hour.':'.$minute.' '.$format);
That's the correct version ! 那是正确的版本!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.