0

With a YYYY-MM-DD HH:MM:SS date I always store the UTC time. When I pull to display I translate timezones with built-in PHP functions and classes.

I believe that is one correct way to do it and it makes sense to me.

May I handle YYYY-MM-DD the same way?

  • 2
    In addition to ChrisF's comments ... why wouldn't you handle the date the same way? Move the whole timestamp to UTC and be consistent. Where's the problem? – user53019 Dec 22 '12 at 2:24
6

That would depend on how you interpreted the date.

If you use the date as though it were YYYY-MM-DD 00:00:00 (or any specific time) then you would probably want to take account of time zones.

If you use the date as just on indication of the day then you probably don't.

This is vague as without the context of what you are doing with the dates, it is just guesswork.

0

A date alone is pretty meaningless without the location/timezone.

http://en.wikipedia.org/wiki/Coordinated_Universal_Time

http://en.wikipedia.org/wiki/Time_zone

http://en.wikipedia.org/wiki/List_of_UTC_time_offsets

UTC offsets range from -12:00 to +14:00. That's a span of 26 hours, plus the 24 hours the day will last. This means that yesterday's doomsday (yesterday relative to my local timezone) lasted for a total of 50 hours. I.e. for 50 hours, somewhere on the world it is the 21st Dec. 2012. And then there's the daylight saving time.

Did you see any end-of-the-world-agenda (2:00pm - The Mayans will return to earth with an alien spaceship) or end-of-the-world-24h-countdown that included the timezone?

  • "for 50 hours, somewhere on the world it is the 21st Dec. 2012" You mean for 26 hours, right? – Kenzo Dec 22 '12 at 9:49
  • No 50 hours - when it was 12:01 AM in London it had been the 21st of December for hours in Australia, and it was many hours away from being the 21st in Hawaii. Each point on the earth experienced the day for 24 hours but the world experienced it for 50. – mhoran_psprep Dec 22 '12 at 12:55
  • actually, if you consider the limiting integral for all points on the planet, it is an unbound upper limit. – ADP Dec 22 '12 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.