Sometimes it is necessary to calculate the offset for the current timezone. Therefore you can use this helpful snippet:
SET @tzOffset = (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(CONVERT_TZ(NOW(), 'Etc/UTC', 'Europe/Berlin')));
That’s it.
Sometimes it is necessary to calculate the offset for the current timezone. Therefore you can use this helpful snippet:
SET @tzOffset = (UNIX_TIMESTAMP()-UNIX_TIMESTAMP(CONVERT_TZ(NOW(), 'Etc/UTC', 'Europe/Berlin')));
That’s it.
Post Comments to "How to calculate MySQL timezone offset"