At 04:57 19/03/2009, you wrote:
Message-ID: <>
Date: Thu, 19 Mar 2009 12:57:44 +0800
From: Ron <>
Subject: php date/time zone

Hi All,

I have a form where in a user will enter a time and choose a timezone.

based on those, i need to insert to db the time as the actual time on their timezone. how can i compute that on php? is it possible?

You can either do it in MySQL, by storing the UTC time of the action, and a timezone offset :

Or you could take Keith Devens approach and handle it in PHP : based on previous post

To determine the users timezone *for* them, in the web page a little javascript would often be able to help set the timezone of a dropdown. then either use that to select the selected option of a <select /> dropdown menu, or put it directly into a hidden field and trust that it's probably as right as you can get it.

The browser may also send header fields which could be used for this (in POST or PUT requests only) but it's not guaranteed or reliable either.

So the best approach would probably be to automatically set the timezone selection using javascript, but allow the user to modify it before posting the form

Cheers - Neil

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to