手机
当前位置:查字典教程网 >编程开发 >php教程 >php strtotime 函数UNIX时间戳
php strtotime 函数UNIX时间戳
摘要:如果time的格式是绝对时间则now参数不起作用。如果time的格式是相对时间则其所相对的时间由now提供,或者如果未提供now参数时用当前...

如果 time 的格式是绝对时间则 now 参数不起作用。如果 time 的格式是相对时间则其所相对的时间由 now 提供,或者如果未提供 now 参数时用当前时间。失败时返回 -1。

<?php

echo strtotime ("now"), "n";

echo strtotime ("10 September 2000"), "n";

echo strtotime ("+1 day"), "n";

echo strtotime ("+1 week"), "n";

echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "n";

echo strtotime ("next Thursday"), "n";

echo strtotime ("last Monday"), "n";

?><?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()是一样的.

【php strtotime 函数UNIX时间戳】相关文章:

php恢复数组的key为数字序列的方法

php函数重载的替代方法

PHP5.2下preg_replace函数的问题

php调整服务器时间的方法

桌面中心(四)数据显示

php中检查email完整性

PHP 判断数组是否为空的5大方法

php实现修改新闻时删除图片的方法

php显示时间常用方法小结

php中file_exists函数使用详解

精品推荐
分类导航