Re: date math

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: Re: date math
Groups: php.general 
Request: Send a blank email to php-general+get-283@lists.php.net to get a copy of this message
Eric, One of the most elegant ways to do things like that is using the very extended MySQL Date and Time funcions (http://www.mysql.com/php/manual.php3?section=Date_and_time_functions). In cases similar to yours I'd recommend MySQL functions like NOW(), DATE_ADD(),DATE_SUB(), or - as a collegue replied - the INTERVAL argument within the SELECT statement. Under the link above you will find simple examples for each function as well. (Why calculating by your own, if your cult dbms does it even better ;-) !) HTH Steff >I am writing a small little function to find all >entries in a table and echo them that are 14 days >prior to the current day. I have figured it out >if the entry is in the same month. >But a late entry in the previous month has me a >bit confused. >I am using date() to find the current day , and >have a nifty timestamp in my table. > > Thanks > Eric > >__________________________________________________ >Do You Yahoo!? >Send instant messages & get email alerts with Yahoo! Messenger. >http://im.yahoo.com/ > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#283) next »