Ive got a script that is allows users to submit data to a db, when data is submitted a timestamp is also added, my local time zone is GMT, as is my server time as set it plesk 11, but when the data comes in its an hour behind, due to daylight savings.

Whats the best way to counteract this, i was thinking of setting my time zone -1 hour, but that seems like a bit of a dirty way to do it.


The best way (IMHO) is to write an UTC timestamp. This is always correct and can be converted into any given timezone with appropriate DST rules taken into account by your application and it's library functions.


What is wrong with using the native system time (or converting the client systems' time into the time used for the db server)? Every major OS handles timezone DST natively. (Even when the DST specs change, the relevant OSs are patched to accomodate.)


If you use NTP it should automatically correct your clock to DST if the timezone you selected has it enabled.

But i agree with SvW. UTC would be better if you and your clients are on different timezones.

Not the answer you're looking for? Browse other questions tagged or ask your own question.