I have a timezone mismatch I need to correct in a table. All dates and times before unix timestamp 1253568477 need to have 5 hours added to their values to make them equal GMT.
I have the following columns...
date
(data type date
), off by -5 hours
time
(data type time
), off by -5 hours
timestamp
(data type int
), this column is the correct time
The reason the timezones are off is because of the way I was setting the values when inserting the rows...
$sql = "insert into email_opens (userid, email, serial, date, time, timestamp) values (
'$userid',
'$opened_by',
'$serial_number',
now(),
now()',
'".gmmktime()."'
)";
The now()
value was using the server timezone (eastern) whereas the gmmktime
value specified GMT. I have since corrected this query to always use GMT.
Is there a way I can add 5 hours to both time
and date
columns for those rows where timestamp < 1253568477 in one batch query?
Clarification:
My goal is to update each incorrect row in the table with the correct time by adding 5 hours to each value.