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

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

问题描述:

I have the following query in some code...

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

I want to change and timestamp > '".time()."'"); to time - 1 day. I tryed something like...

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

...with no luck. Page simply fails to load, so I'm sure the syntax is not even valid. Any help appreciated...

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

  $ student_result = db_query(“select id,timestamp,time_id,unschedule_code from student where cancelled ='0'and email ='”。$ email。“'and timestamp>'”。time()。“'”);  
  code>  pre> 
 
 

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

  $ student_result = db_query(”select id,timestamp,  time_id,unschedule_code来自学生,取消='0',电子邮件='“。$ email。”'和timestamp>'“。time()。 -  1”'“); 
  code>  pre>  
 
 

...没有运气。页面无法加载,所以我确信语法甚至无效。任何帮助都赞赏... p> div>

Timestamps are in seconds, try:

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