php strtotime 函数UNIX时间戳
author:一佰互联 2019-05-01   click:175
如果 time 的格式是绝对时间则 now 参数不起作用。如果 time 的格式是相对时间则其所相对的时间由 now 提供,或者如果未提供 now 参数时用当前时间。失败时返回 -1。

<?php
echo strtotime ("now"), " ";
echo strtotime ("10 September 2000"), " ";
echo strtotime ("+1 day"), " ";
echo strtotime ("+1 week"), " ";
echo strtotime ("+1 week 2 days 4 hours 2 seconds"), " ";
echo strtotime ("next Thursday"), " ";
echo strtotime ("last Monday"), " ";
?><?php
$str = "Not Good";
if (($timestamp = strtotime($str)) === -1) {
echo "The string ($str) is bogus";
} else {
echo "$str == ". date("l dS of F Y h:i:s A",$timestamp);
}
?>
这个效果和用mktime()是一样的.