MySQL – How to Detect Current Time Zone Name in MySQL

MySQL - How to Detect Current Time Zone Name in MySQL world_time_zone_map

MySQL developers and DBA often face a very simple challenge when they have to retrieve the time zone of the session which they are connected to. If you look at MySQL documentation and search engine there are many different ways to do the same. In this blog post, I will demonstrate the simple method which I use to detect Timezone of the server I am connected with the current session.

Run following script in against your MySQL server:

SELECT @@system_time_zone;

It will return the result set with the name of your Timezone. For example, I am in India and the time zone of my machine is India Standard Time hence the result will contain the same.

MySQL - How to Detect Current Time Zone Name in MySQL timezone

Let me know if you use any other method to retrieve the Timezone of the server where MySQL is installed.

Reference: Pinal Dave (https://blog.sqlauthority.com)

MySQL, SQL DateTime
Previous Post
SQL SERVER – Get Current TimeZone Name in SQL Server
Next Post
MongoDB and MySQL – Comparing Scalability, Data Distribution & Query Model – Part 1

Related Posts

Leave a Reply