Skip to content
The Chat Archive
gpt-4-0314· OpenAI Arena Human Preference 55K

I have this problem with sql. This sql query returns an error: UPDATE datosSensores SET…

  1. User

    I have this problem with sql. This sql query returns an error: UPDATE datosSensores SET fecha = '2023-03-26 02:01:10' WHERE datosSensores.id = 1897; However UPDATE datosSensores SET fecha = '2023-03-26 03:01:10' WHERE datosSensores.id = 1897; it does work. Why it works changing the hour from 2 to 3?

  2. Assistant

    The issue you are encountering might be related to Daylight Saving Time (DST). On March 26, 2023, many regions will observe DST, and at 2:00 AM, the clocks will be moved forward to 3:00 AM.

    If your database server is in a timezone that observes DST, it might not allow you to set a non-existing datetime due to the clock change. When you update the time to 3:01:10, it is a valid time after the DST change, so the query works without any issue.

    To resolve this, you can either use a timezone that does not observe DST or store date and time data in UTC format, which does not have daylight saving adjustments. You can convert the local time to UTC before storing it in the database and convert it back to the local time when retrieving it.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.