I have some dates stored in gmt in a mysql db.
Say the clients timezone offset was -540; how would I correct the datetime coming from the database to reflect that? Is there a handy function I can put the date through, or am I going to need to add or subtract accordingly.
I have some dates stored in gmt in a mysql db. Say the clients
Share
Since you have the data items in GMT format, you will have to convert them to time stamps, using
strtotime, more info here: http://php.net/manual/en/function.strtotime.phpOnce you have the time stamp, you can subtract the offset (540 times 60 seconds) from it, and then convert the result to a new date string, using
date, more info here: http://php.net/manual/en/function.date.phpHere is one version of the code that could to this: