# Mysql and daylight saving time

**URL:** https://discourse.nodered.org/t/mysql-and-daylight-saving-time/92713
**Category:** General
**Created:** [27 October 2024 16:46 UTC](https://discourse.nodered.org/t/mysql-and-daylight-saving-time/92713 "2024-10-27T16:46:34Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [27 October 2024 18:55 UTC](https://discourse.nodered.org/t/mysql-and-daylight-saving-time/92713/3 "2024-10-27T18:55:09Z")

</div>

I guess that was this thread [https://discourse.nodered.org/t/yet-another-sql-timestamp-doubt/91301/14](https://discourse.nodered.org/t/yet-another-sql-timestamp-doubt/91301/14)

I have looked online but i confess I'm overwhelmed by all the out of date / incorrect information and jargon.

My database is running on a Pi.  
timedatectl gives me

```auto
               Local time: Sun 2024-10-27 18:18:50 GMT
           Universal time: Sun 2024-10-27 18:18:50 UTC
                 RTC time: n/a
                Time zone: Europe/London (GMT, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

```

and in mysql

```auto
SELECT @@global.time_zone, @@session.time_zone;
+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| SYSTEM | SYSTEM |
+--------------------+---------------------+
1 row in set (0.000 sec)

```

I understand that means MySQL is using the system timezone but I don't know how to interpret the timedatectl output.

Does `Time zone: Europe/London (GMT, +0000)` mean it's GMT today, or is it always GMT?

Trying to follow the examples online is most frustrating...

`edit /etc/my.cnf.d/server.conf`  
Doesn't exist.

```auto
sudo vi /etc/mysql/my.cnf
find [mysql] section

```

No such section.

There is a file /etc/mariadb/mariadb.conf.d/50-server.cnf which contains a [mysqld] section.

```auto
After opening the file, we need to scroll down a bit to find the `[mysqld]` section, and here we will see `default-time-zone = "+00:00"`. Here `"+00:00"` shows an offset from the GMT zone.

```

Nope.

Well let's add it and see what happens. Umm do I need those back ticks?

Restart mysql.

Now I see

```auto
SELECT @@global.time_zone, @@session.time_zone;
+--------------------+---------------------+
| @@global.time_zone | @@session.time_zone |
+--------------------+---------------------+
| +00:00 | +00:00 |
+--------------------+---------------------+

```

Is that correct?  
I guess I'll need to subtract an hour from all the timestamps before last night?

---

_[View the full topic](https://discourse.nodered.org/t/mysql-and-daylight-saving-time/92713)._
