Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP JSON如何减去日期和时间_Php_Json - Fatal编程技术网

PHP JSON如何减去日期和时间

PHP JSON如何减去日期和时间,php,json,Php,Json,我有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"; } 将日期减去1天,将日期替换为$your\u date\u time date('Y-m-d', strt

我有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";
}

将日期减去1天,将日期替换为
$your\u date\u 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";
}

希望这有帮助

嗨,杰瑞,欢迎来到SO。请花点时间研究一下,以改进您的问题: