Re: PDT to EST

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux