0

Possible Duplicate:
MySQL datetime fields and daylight savings time — how do I reference the “extra” hour?

Unfortunately, I can't test if some problems appear when clocks switch 1 hour back on the server (it happens once a year, 1 hour ahead is not so bad). Anyway, I don't want some transactions on the shared hosting server became unexpectedly ordered in a wrong order (between 2am and 3am of the night when clock goes back for 1 hour). All I want is to have a proper order in the database. What should I check on the server? What should I know? As for me it's like a Y2k problem in 1998: it didn't happened yet, but I have to be ready :D

Thank you.

Community
  • 1
  • 1
Haradzieniec
  • 9,086
  • 31
  • 117
  • 212
  • 2
    same question answered here http://stackoverflow.com/questions/1646171/mysql-datetime-fields-and-daylight-savings-time-how-do-i-reference-the-extra – Liam Allan Nov 16 '11 at 23:44

1 Answers1

1

If you ask me, a great way to get around it is to store unix timestamps rather then the actual date string for this very reason. Leave it to your application to convert to the local timezone instead. Otherwise clock switches can always be a pain. Another advantage to this is any ordering or selecting you may need to do on the table is much more efficient on integers rather then date strings.

This may be a little more time consuming then you are hoping for, but if you store the local time in the local time format in your database, you will continue to run into these kinds of problems.

Shane Fright
  • 385
  • 1
  • 9