PDA

Click to See Complete Forum and Search --> : Select Date as GMT?[RESOLVED]


john tindell
Apr 11th, 2005, 05:54 PM
Hey the MySQL server my site is hosted on is about 5 hours behind GMT, I want the dates on my site displayed as GMT. Does anyone know of a way that i can Select a GMT correct time from the database?

The query I use to get the date field at the moment is

DATE_FORMAT(time,"%h:%i%p") as time


This would return date as "06:58PM" rather than "11:58PM"

I would much rather find a MySQL solution rather than changing the date via PHP.

Thanks

visualAd
Apr 12th, 2005, 07:36 AM
The only function they have for this sepcifically is the CONVERT_TZ function, but, that is only avaialable from MySql 4.1.3. Here is how you would use it:

CONVERT_TZ(date,'-05:00','+00:00')

If not you can instead add an interval of 5 hours to the time:

SELECT '2005-01-01 14:15' + INTERVAL 5 HOUR;