globetrottingmike Posted April 13, 2009 Share Posted April 13, 2009 Hi, I have developed a php/mysql application which I want my members to be able to see say forum posts in their local time zone. Their time zone info would be stored in the members table of the database, so a member living in Paris would have a +1 hr time zone difference stored in their profile from my server in London. I have worked out from loads of searching that the following piece of script can adjust the current time (NOW) by adding or subtracting what is stored in that database field: function getLocalTime($tm, $offset){ return ($tm - date("Z", $tm)) + (3600 * $offset); } // get current local time in bangkok echo date("H:i:s d-m-y", getLocalTime(mktime(), $row_rs_timezone['difference'])). "<br>"; And I know that this line of code shows the date of the entry from the database data: <?php echo date ("d M Y",strtotime($row_wall ['wall_date'])); ?> How can I know marry the two up? I want to retrieve the date and time from the database item, say the forum post, and then use the first script I showed to calculate the difference? Many thanks in advance Link to comment https://forums.phpfreaks.com/topic/153913-time-zone-support/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.