I have show times stored in all in Eastern and ID from timezone settings table. Timezone settings table has Timezone_id, GMT offset and the timezone Name.
GMT offset are stored like +6, -4, +3.5, -4.5, etc.
I am trying to write a query to pull the showtime converted to its original timezone. I am doing like this.
SELECT Date_format( CONVERT_TZ( CONVERT_TZ(A.START_TIME, '+00:00', '-5:00'),
'+00:00', CONCAT(B.GMT_OFFSET , ':00' )), '%Y-%m-%e %r:%i')
AS 'start_time' from shows A, tz_settings B AND <<JOINS>>;
What I am doing here is first to convert the time from ET to GMT and then applying the GMT offset.
START_TIME is in date format like '2012-4-23 10:15:00' Also, one more problem is converting formats like "3.5" to "3.30" to pass to Convert_TZ
EDIT: Table structure. Main fields.
shows: 'id', 'show_name', 'stat_time', 'tz_id'
tz_settings: 'tz_id', 'gmt_offset','tz_name'
Any ideas? Any other functions would help in the mix?