How to get time zone offset in MySQL?
Hello everyone.
Recently, while working on a project, I needed the time zone offset. I could have calculated the time zone offset in PHP, but I thought it would be easier and more advantageous to find it in MySQL. So, I created a query that calculates the time zone offset and will share it with you.
SELECT TIME_FORMAT(TIMEDIFF(NOW(), CONVERT_TZ(NOW(), 'Asia/Kathmandu', 'UTC')), '%H:%i') as offset;
The result will be as follows;
’05:45′