PHP时间戳格式
问题描述:
我从来没有想过这会是这样的痛苦。将此时间戳转换为strtotime()接受的标准PHP时间戳的最佳方式是什么? :PHP时间戳格式
2017年9月29日,7:16 UTC
的格式是:
日期( “FĴ,Y,G:ⅰT”)
答
先构建DateTime对象,然后将其格式化为标准格式,然后传递到strtotime。
$date = "September 29, 2017, 7:16 UTC";
$day = new DateTime($date);
$utc = strtotime($day->format("Y-m-d g:i A"));
使用'strtotime'时会发生什么? – chris85
它正在转换罚款,'$ timestamp = strtotime('2017年9月29日,7:16 UTC'); echo $ timestamp; echo date(“F j,Y,G:i T”,$ timestamp);'问题是什么? –
感谢您的快速回复和确认!事实上,还有一个问题,可能是我提供给时间轴的字符串。我不知道,可能问题出在屏幕和椅子之间。 –