Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 421313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:58:15+00:00 2026-05-12T18:58:15+00:00

I’m using the America/New York timezone. In the Fall we fall back an hour

  • 0

I’m using the America/New York timezone. In the Fall we “fall back” an hour — effectively “gaining” one hour at 2am. At the transition point the following happens:

it’s 01:59:00 -04:00
then 1 minute later it becomes:
01:00:00 -05:00

So if you simply say “1:30am” it’s ambiguous as to whether or not you’re referring to the first time 1:30 rolls around or the second. I’m trying to save scheduling data to a MySQL database and can’t determine how to save the times properly.

Here’s the problem:
“2009-11-01 00:30:00” is stored internally as 2009-11-01 00:30:00 -04:00
“2009-11-01 01:30:00” is stored internally as 2009-11-01 01:30:00 -05:00

This is fine and fairly expected. But how do I save anything to 01:30:00 -04:00? The documentation does not show any support for specifying the offset and, accordingly, when I’ve tried specifying the offset it’s been duly ignored.

The only solutions I’ve thought of involve setting the server to a timezone that doesn’t use daylight savings time and doing the necessary transformations in my scripts (I’m using PHP for this). But that doesn’t seem like it should be necessary.

Many thanks for any suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:58:16+00:00Added an answer on May 12, 2026 at 6:58 pm

    MySQL’s date types are, frankly, broken and cannot store all times correctly unless your system is set to a constant offset timezone, like UTC or GMT-5. (I’m using MySQL 5.0.45)

    This is because you can’t store any time during the hour before Daylight Saving Time ends. No matter how you input dates, every date function will treat these times as if they are during the hour after the switch.

    My system’s timezone is America/New_York. Let’s try storing 1257051600 (Sun, 01 Nov 2009 06:00:00 +0100).

    Here’s using the proprietary INTERVAL syntax:

    SELECT UNIX_TIMESTAMP('2009-11-01 00:00:00' + INTERVAL 3599 SECOND); # 1257051599
    SELECT UNIX_TIMESTAMP('2009-11-01 00:00:00' + INTERVAL 3600 SECOND); # 1257055200
    
    SELECT UNIX_TIMESTAMP('2009-11-01 01:00:00' - INTERVAL 1 SECOND); # 1257051599
    SELECT UNIX_TIMESTAMP('2009-11-01 01:00:00' - INTERVAL 0 SECOND); # 1257055200
    

    Even FROM_UNIXTIME() won’t return the accurate time.

    SELECT UNIX_TIMESTAMP(FROM_UNIXTIME(1257051599)); # 1257051599
    SELECT UNIX_TIMESTAMP(FROM_UNIXTIME(1257051600)); # 1257055200
    

    Oddly enough, DATETIME will still store and return (in string form only!) times within the “lost” hour when DST starts (e.g. 2009-03-08 02:59:59). But using these dates in any MySQL function is risky:

    SELECT UNIX_TIMESTAMP('2009-03-08 01:59:59'); # 1236495599
    SELECT UNIX_TIMESTAMP('2009-03-08 02:00:00'); # 1236495600
    # ...
    SELECT UNIX_TIMESTAMP('2009-03-08 02:59:59'); # 1236495600
    SELECT UNIX_TIMESTAMP('2009-03-08 03:00:00'); # 1236495600
    

    The takeaway: If you need to store and retrieve every time in the year, you have a few undesirable options:

    1. Set system timezone to GMT + some constant offset. E.g. UTC
    2. Store dates as INTs (as Aaron discovered, TIMESTAMP isn’t even reliable)

    3. Pretend the DATETIME type has some constant offset timezone. E.g. If you’re in America/New_York, convert your date to GMT-5 outside of MySQL, then store as a DATETIME (this turns out to be essential: see Aaron’s answer). Then you must take great care using MySQL’s date/time functions, because some assume your values are of the system timezone, others (esp. time arithmetic functions) are “timezone agnostic” (they may behave as if the times are UTC).

    Aaron and I suspect that auto-generating TIMESTAMP columns are also broken. Both 2009-11-01 01:30 -0400 and 2009-11-01 01:30 -0500 will be stored as the ambiguous 2009-11-01 01:30.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.