NYCPHP Meetup

NYPHP.org

[nycphp-talk] how to correct wrong mysql datetime columns?

David Mintz david at davidmintz.org
Tue Dec 2 10:45:46 EST 2008


This isn't necessarily PHP but... close enough? You could script a solution
in PHP and indeed I might.

I had two CentOS servers' date info somehow go bad over the weekend. When I
came back to work they thought it was 1993, wreaking havoc with the
PHP/MySQL application hosted thereon. I restarted ntpd and they are now
apparently doing fine, thanks. But I have some tables where the record
creation date is saved using MySQL's  now(). There are now some rows with
the wrong value in this field and I am not quite clever enough to see the
best way to fix.

The last output I have from the 'date' command before it was corrected is
Wed Mar  3 18:40:05 EST 1993. When we got back to the present, 'date' said
Tue Dec  2 09:20:05 EST 2008. Should I convert both to Unix timestamps,
subtract the smaller from the larger and add that number of seconds to the
values that I know are wrong? btw I know this number won't be exact but
close enough will do, there being no alternative AFAIK.

Gratefully,

-- 
David Mintz
http://davidmintz.org/

The subtle source is clear and bright
The tributary streams flow through the darkness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20081202/7761715a/attachment.html>


More information about the talk mailing list