On Fri, 19 Nov 2004 12:56:55 +0100, Venelin Arnaudov <venstar@xxxxxxxxx> wrote: > I have a legacy PHP3 system and a MySQL DB with two tables: > [...] > When a user submits a message, my PHP script (using time() function) > stores the submission time in messages.date field. However this value is > not the server's system time but shifted according the users timezone. > > 1. How can I convert it to reflect my timezone (ex. GMT)? Is there a way > to find the offset between two timezones given in long format as in my > table? MySQL assumes that the dates you supply are in your servers local timezone. You can convert dates from the users time to your local timezone using the builtin MySQL function CONVERT_TZ(datetime, from_tz, to_tz). See the MySQL manual for details: http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html#IDX1410 If you want to use "long format" timezones rather than offsets, you may have to do a little extra work with MySQL as the zoneinfo tables are not automatically loaded - the manual explains... http://dev.mysql.com/doc/mysql/en/Time_zone_support.html -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php