在php中减去一天的时间方法

时间:2014-02-19 19:00:53

标签: php

我在某些代码中有以下查询...

$student_result = db_query("select id,timestamp,time_id,unschedule_code from student where canceled='0' and email='".$email."' and timestamp > '".time()."'");

我想要更改时间戳> '“.time()。”'“);到时间 - 1天。我尝试了类似......

$student_result = db_query("select id,timestamp,time_id,unschedule_code from student where canceled='0' and email='".$email."' and timestamp > '".time(). - 1"'");

......没有运气。页面无法加载,因此我确信语法甚至无效。任何帮助表示赞赏...

1 个答案:

答案 0 :(得分:2)

时间戳以秒为单位,请尝试:

$student_result = db_query("select id,timestamp,time_id,unschedule_code from student where canceled='0' and email='".$email."' and timestamp > '".(time()-(3600*24))."'");
相关问题