Re: PDT to EST
| From: | Adam Royle | Date: | Sun, 13 Apr 2003 22:11:01 +0000 |
| Subject: | Re: PDT to EST | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-27063@lists.php.net to get a copy of this message | ||
Not sure if this will help you, but here goes.
I developed a (very basic) small blog type thing, where me and my friends would write shit down. It
was originally hosted on my box at home, but I later moved it to a PHP server in the USA. I had a
dilemma - the dates were all stuffing up (due to the change of server locale). My date/time of the
posting was stored in a mySQL db as a unix timestamp (created using php's time() function). I
then wrote the following jigitty to display the time correctly, despite the locale of the server.
You can see below the timestamp of the post resides inside $row["msgDate"]. For people who
do not live in Brisbane, change the value 36000 to suit your timezone offset.
date("D jS M Y | g:ia | ", $row["msgDate"] - date("Z",time()) +
36000);
HTH,
Adam