UNIX strtotime php strtotime 函数UNIX时间戳

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

UNIX strtotime php strtotime 函数UNIX时间戳

  2021-03-17 我要评论
想了解php strtotime 函数UNIX时间戳的相关内容吗,在本文为您仔细讲解UNIX strtotime的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:php,strtotime,UNIX,时间戳,下面大家一起来学习吧。
如果 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()是一样的.

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们