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()是一样的.
<?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()是一样的.
相关推荐
清风徐来水波不兴 2020-06-09
nimeijian 2019-10-24
辛苦的字幕君小样 2013-05-16
theScoreONE 2019-06-28
怕什么真理无穷 2019-06-26
静心斋 2012-05-31
wangdoudou0 2012-01-31
微米游戏开发团队 2017-11-28
pengjincheng 2011-07-12
史玉明 2015-08-11
cssssb 2009-12-09
贝伦酱 2009-12-08
itkissit 2009-12-03
飞空静渡 2009-11-23
phpcrazy 2019-04-16
phptyong 2019-04-16
phptyong 2019-04-15