脚本宝典收集整理的这篇文章主要介绍了php常用的时间戳,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
strtotime('now')
strtotime('today')
strtotime('tomorrow')
strtotime('yesterday')
strtotime(date('Y-m-d', strtotime('+1 day')))
strtotime('tomorrow') - time()
strtotime(”2009-1-22″)
strtotime(”+1 day”)
date(”Y-m-d H:i:s”,time())
date(”Y-m-d H:i:s”,strtotime(”+1 day”))
strtotime(”-1 day”)
date(”Y-m-d H:i:s”,time())
date(”Y-m-d H:i:s”,strtotime(”-1 day”))
strtotime(”+1 week”)
date(”Y-m-d H:i:s”,strtotime(”+1 week”))
strtotime(”-1 week”)
date(”Y-m-d H:i:s”,strtotime(”-1 week”))
strtotime(”next Thursday”)
date(”Y-m-d H:i:s”,strtotime(”next Thursday”))
strtotime(”last Thursday”)
date(”Y-m-d H:i:s”,strtotime(”last Thursday”))
strtotime能将任何英文文本的日期时间描述解析为UNIX时间戳;
结合mktime()或date()格式化日期时间获取指定的时间戳,实现所需要的日期时间。
php date() 输出24小时制时间的方法:
echo date("Y-m-d H:i:s");
输出12小时制时间的方法:
echo date("Y-m-d h:i:s");
以上是脚本宝典为你收集整理的php常用的时间戳全部内容,希望文章能够帮你解决php常用的时间戳所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。