gpt4 book ai didi

php, date() 没有返回正确的日期/时间

转载 作者:搜寻专家 更新时间:2023-10-31 21:15:43 28 4
gpt4 key购买 nike

下面的代码...

$date = "02-13-2012";
$start_time = "17:30";
$end_time = "20:00";

$start_timestamp = date("m-d-Y H:i",strtotime($date." ".$start_time));
$end_timestamp = date("m-d-Y H:i",strtotime($date." ".$end_time));

print($start_timestamp);
print($end_timestamp);

返回...

1969-12-31 19:30:00

1969-12-31 20:30:00

有谁知道为什么这不能正常工作?

最佳答案

02-13-2012 17:30 不是 recognized date format .使用日-月-年或年-月-日顺序,或使用例如 DateTime::createFromFormat 自定义解析日期格式.

关于php, date() 没有返回正确的日期/时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9270680/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com