如何将人类可读的日期字符串转换回时间


How to convert human-readable date string back into time

我的网站使用以下代码:

$a1="1293011062"; // hex code umm i think !
$expires = date('M d, Y', $a1);
echo $expires; // Output Dec 22, 2010

如何进行反向操作?也就是说,如果我想将Apr 06, 2012转换为十六进制,它在a1中的表示方式是什么?

您可以使用strtotime:http://us2.php.net/strtotime这不是十六进制

<?php
$a1="1293004800";
$expires = date('M d, Y', $a1);
echo $expires . "<br/>"; // Output Dec 22, 2010
echo strtotime($expires); // 1293004800
?>