Re: syntax

From: Date: Tue, 24 Feb 2009 22:23:10 +0000
Subject: Re: syntax
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-288769@lists.php.net to get a copy of this message
Micah Gersten napsal(a):
Martin Zvarík wrote:
Chris napsal(a):
    
Terion Miller wrote:
Need syntax help when it comes to using a timestamp.
What I'm trying to say in my query WHERE clause is to select records if the timestamp on the record is in the past 7 days from NOW() $query .= " WHERE stamp < NOW()-7 "; I have no clue here on this .... the lay language is WHERE stamp is within the past 7 days.... how to php that? lol
        
Has nothing at all to do with php. http://dev.mysql.com/doc/refman/5.0/en/datetime.html http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html
      
$query .= " WHERE stamp < ".(time()-7*3600*24);
    Using something like that is disastrous for DST and Leap Seconds...
Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com I personally wouldn't even use the timestamp type for this column, but 'datetime' instead. Anyway, I don't think he is worried about DST, which I don't think is a problem when you have the right settings - nor second precision.

« previous php.general (#288769) next »