unix时间戳之间的时差

pau*_*d78 1 php

如果unix时间戳在当前日期的21天到49天之间,我必须尝试解决.任何人都可以帮我解决这个问题吗?谢谢!

Dav*_*nco 5

欢迎来到SO!
这应该这样做:

if (($timestamp > time() + 1814400) && ($timestamp < time() + 4233600)) {
 // date is between 21 and 49 days in the FUTURE
}
Run Code Online (Sandbox Code Playgroud)

这可以简化,但我想你想看到一个更冗长的例子:)

我得到181440021*24*60*60423360041*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)