RE: [PHP] Timestamp math and format

From: Date: Fri, 19 Oct 2001 14:42:36 +0000
Subject: RE: [PHP] Timestamp math and format
Groups: php.general 
Request: Send a blank email to php-general+get-71595@lists.php.net to get a copy of this message
Thanks, That was just what I needed, ie: SELECT DATE_FORMAT(DATE_SUB(insert_date, INTERVAL 2 HOUR), '%b %e (%r)') Johan > On 17-Oct-2001 Alfredeen Johan K wrote: > > I store a timestamp in a database of when a record was > inserted. When I pull > > it out, I format it like this SELECT > DATE_FORMAT(insert_date,'%b %e (%r)') > > AS idate > > > > Now I would like to subtract 2 hours from the hour part of > the timestamp. > > What's the easiest way to do this, before or after the > formatting? In PHP or > > mySQL function? Can someone give me some code of how they > would do this. > > > > SELECT DATE_FORMAT(DATE_SUB(insert_date, INTERVAL 2 HOUR), > '%b %e (%r)') > > Regards, > -- > Don Read dread@texas.net > -- It is necessary for me to learn from others' mistakes. I > will not live long enough to make them all by myself. >

« previous php.general (#71595) next »