Re: Timestamp math and format
| From: | David Robley | Date: | Thu, 18 Oct 2001 00:45:21 +0000 |
| Subject: | Re: Timestamp math and format | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71428@lists.php.net to get a copy of this message | ||
On Thu, 18 Oct 2001 01:31, 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.
>
> Thanks,
>
> Johan
Have a look at the mysql date and time functions; SUB DATE might be what
you want.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Universe is a big place... perhaps the biggest