欢迎来到SO!
这应该这样做:
if (($timestamp > time() + 1814400) && ($timestamp < time() + 4233600)) {
// date is between 21 and 49 days in the FUTURE
}
Run Code Online (Sandbox Code Playgroud)
这可以简化,但我想你想看到一个更冗长的例子:)
我得到1814400的21*24*60*60和4233600从41*24*60*60.
编辑:我假设未来的日期.另请注意,自PHP中的Epoch以来time()返回秒(而不是毫秒).
这就是你过去的做法(因为你编辑了你的问题):
if (($timestamp > time() - 4233600) && ($timestamp < time() - 1814400)) {
// date is between 21 and 49 days in the PAST
}
Run Code Online (Sandbox Code Playgroud)