我有php代码,我从json请求中提取了一个日期。 json时间数据打印为
2017-07-01T07:32:57Z
你能提供两个例子:
示例1如何将时间减去1天
示例2 php if语句。
if(current time IS 60 Minutes > than JSON time and date){
echo "time is great than 60 minutes";
}
答案 0 :(得分:0)
将日期减去1天,在$your_date_time
date('Y-m-d', strtotime('-1 day', strtotime($your_date_time)))
检查时间是否超过60分钟
if(strtotime($your_date_time) > strtotime("-60 minutes")) {
echo "time is great than 60 minutes";
}
希望这会有所帮助