0

I want to insert this value: 2020-03-29 01:00:00

If I set up a column called date with data type datetime I can insert the value. But if I use the data type timestamp I cannot insert and get an error message:

Incorrect datetime value: '2020-03-29 01:00:00' for column 'date' at row 1

Furthermore, if I insert 2020-03-29 02:00:00 using data type timestamp it works... seriously, what is going on here?

I am using the GMT timezone. I'm creating a 2020 calendar table where I want to insert every hour in a year. Should I skip that time?

0

This is because of the daylight time-saving change. You're trying to insert an unexisting timeframe, so we can call it the daylight saving gap.

Solution: Just skip that specific time in your table.

| improve this answer | |
  • What about the other time change? When an hour repeats! – Rick James Dec 6 '19 at 1:29
1

If you want to catch every hour that exists, have a sequence of integers and do

x + INTERVAL y HOUR

Where x is some constant base time and y is the sequence of hours. The result of the sum is a valid hour, suitably converted according to DST hours, leap years, etc.

| improve this answer | |

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.