需要帮助在PHP中转换strtotime()

时间:2018-07-01 01:36:00

标签: php

我正在尝试对php中的时间进行排序。我使用strtotime将字符串转换为php中的时间并进行排序。

example.com/support

为我工作,我可以按年/月/日对时间进行排序。

但是当我尝试:

$temp = strtotime("$year/$month/$day");

当我尝试按$temp = strtotime("$year/$month/$day $h:$m:$s"); 进行时间排序时,它不起作用。

非常感谢任何人能给我一些帮助。

1 个答案:

答案 0 :(得分:0)

如果双引号不能正确构建字符串,请使用.代替双引号串联。

strtotime($year."/".$month."/".$day." ".$h.":".$m.":".$s);
相关问题