【发布时间】:2020-07-24 16:40:19
【问题描述】:
如何根据 php 后端中的日期和时间计算某些内容是否已过期。无论时区如何,它都应该适用于用户。
数据库中的时间戳 2020-07-24 21:24:27
超时值来自api 00:03:47
if((2020-07-24 21:24:27 + 00:03:47) < date()) {
echo "expired";
} else {
echo "pending";
}
【问题讨论】:
-
这能回答你的问题吗? How can I compare two dates in PHP? - 只需按照那里的答案,但修改格式以匹配您的(包括 UTC 时间)