我们使用time()可以打印出时间戳,但是我们想要加个偏移,比如用于缓存等,我们就要添加时分秒的偏移,可以用下边的代码实现
echo time() , "<br/>";
echo strtotime("+1 minute"), "<br/>";
echo strtotime("+120 seconds"), "<br/>";
echo strtotime("now"), "<br/>";
echo strtotime("10 September 2000"), "<br/>";
echo strtotime("+1 day"), "<br/>";
echo strtotime("+1 week"), "<br/>";
echo strtotime("+1 week 2 days 4 hours 2 seconds"), "<br/>";
echo strtotime("next Thursday"), "<br/>";
echo strtotime("last Monday"), "<br/>";
打印结果如下:
1655117721
1655117781
1655117841
1655117721
968515200
1655204121
1655722521
1655909723
1655308800
1654444800
暂无评论
要发表评论,您必须先 登录