Mysql find current timezone offset

Print current local and global timezone

SELECT @@global.time_zone, @@session.time_zone;

Here is the outcome

@@global.time_zone	@@session.time_zone
+05:30	+05:30

Find timezone offset using convert_tz

select TIMEDIFF(now(), convert_tz(now(), @@session.time_zone, '+00:00'));

Here is the outcome when session timezone is India timezone.

05:30:00

Find timezone offset using UTC_TIMESTAMP

SELECT TIMEDIFF(NOW(), UTC_TIMESTAMP());

Here is the outcome when session timezone is India timezone.

05:30:00
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments