在PHP中获取一周前的时间戳? [英] Get the timestamp of exactly one week ago in PHP?

查看:417
本文介绍了在PHP中获取一周前的时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用PHP计算7天前的时间戳,所以如果现在是3月25日下午7:30,它将在3月18日下午7:30返回时间戳。

I need to calculate the timestamp of exactly 7 days ago using PHP, so if it's currently March 25th at 7:30pm, it would return the timestamp for March 18th at 7:30pm.

我应该从当前时间戳中减去604800秒,还是有更好的方法?

Should I just subtract 604800 seconds from the current timestamp, or is there a better method?

推荐答案

strtotime("-1 week")

这篇关于在PHP中获取一周前的时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆