This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Timezones help

Hi there,

Sorry for what may be a silly question. I am very new to MariaDB and just wanted to get some help in understanding how timezones work

I am working with a web dev that is sending across data to my MariaDB database. When initially setting up MariaDb, the global time zone was set to default but I have since changed this to '+00:00'.

The web dev also sent over the code to create the table, which included SET time_zone = "+00:00"; in the code. The date fields were set up to be 'datetime' , example from code (`Entry_Date` datetime DEFAULT NULL,).

I found that the entries were coming in but they were in UTC time rather than my local time (which should be Australia/Melbourne) even when running the below query SET time_zone ='+10:00'; SELECT * FROM Sample

I then changed the field type of 'Entry_Date' to TIMESTAMP, and found that it is behaving differently to DATETIME.

The only issue with using TIMESTAMP field type is that I am no longer getting records sent through (I think my web dev may need to change a config from their end).

Please can someone help point me in the right direction?

Thanks

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.