Many times different time zones can create some confusion among the developers. Therefore, there is a need to check the current time zone of MySQL in a lot of cases. In this article, we will learn how to check the current time zone of MySQL.

The time zone of MySQL can be retrieved using the time zone variables. Let us see how to use them for the purpose.

@@system_time_zone

Observe the below query to get the current time zone.

SELECT @@system_time_zone;

Output:-

image_1

The output in image_1 shows that the current time zone of MySQL is IST.

@@GLOBAL.time_zone

The @@GLOBAL.time_zone gets the global time zone value. Observe the below query.

SELECT @@GLOBAL.time_zone;

Output:-

image_2

The output in image_2 shows that MySQL takes the global time zone value from what is set in the working system.

@@SESSION.time_zone

The @@SESSION.time_zone gets the session time zone value. Observe the below query.

SELECT @@SESSION.time_zone;

Output:-

image_3

The output in image_3 shows that MySQL takes the session time zone value from what is set in the working system.

now()

MySQL function now() will return the date and time values as per the timezone set for MySQL. Observe the below query.

select now();

Output:-

image_4

READ MORE:

We hope this article helped you to get the current time zone of MySQL. Good Luck!!!