跳转到主内容
趣航编程网 - 趣学编程,启航技术之路!

php中的UNIX时间戳函数strtotime

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";?>复制代码例2,$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函数的用法,还可以参考:PHP strtotime函数详细介绍PHP中strtotime函数用法举例php中strtotime()与mktime() 的Y2K38漏洞 2038年问题php时间戳函数 strtotime 应用实例php中strtotime的函数效率

相关文章