Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JoshP's avatar
Level 7

Dealing with DST when scheduling future events

Hi all, I'm a bit stumped here on the best way to move forward.

I just ran into a DST issue for the first time. We use acuity as a scheduling tool, and pull from its api to populate our db. Just had someone update a start time, which when translated to UTC, is 2021-03-14 02:00:00, so mysql throws a

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: ‘2021-03-14 02:00:00’

As far as the client is concerned, they’ve scheduled for 10pm Chicago time. This should be fine.

in UTC, the 2 o’clock hour doesn’t exist, but the 10 o’clock hour does exist in Chicago time.

How does one account for such issues?

0 likes
5 replies
martinbean's avatar

@joshp I don‘t really understand. Why doesn’t “02:00:00” exist? It absolutely does. UTC has a 2 AM, just like any other timezone. It doesn’t magically jump from 1 AM to 3 AM.

tykus's avatar

in UTC, the 2 o’clock hour doesn’t exist,

This is not correct, UTC is daylight savings time agnostic. Does your database have a set timezone?

JoshP's avatar
Level 7

@tykus Checked my staging server...

SELECT @@global.time_zone; // SYSTEM
SELECT @@session.time_zone; // SYSTEM
SELECT @@system_time_zone; // UTC
JoshP's avatar
JoshP
OP
Best Answer
Level 7

In the end, this SO Q/A was exactly my situation. Short version:

Add the timezone option to the database config

'mysql' => [
    // ...

    'timezone'  => '+00:00'
],

The question is also quite well written, and describes the issue I was having much better than I did.

Please or to participate in this conversation.