-1

When i SELECT @@system_time_zone it gives me output as named time zone instead of hours:

@@system_time_zone
Arab Standard Time

I know that Arab Standard Time is +03:00 but i want output as +03:00 instead of named timezone.

May I ask for help from experts?

Amer Hamid
  • 145
  • 6
  • I didn't downvote you, but I think you should not relying on the server time, but rather storing timezone information in your `datetime` objects. Have a look [here](http://stackoverflow.com/questions/2934258/how-do-i-get-the-current-time-zone-of-mysql) for more information. – Tim Biegeleisen Sep 25 '16 at 09:18

2 Answers2

0

This is an example that provides you with the expected result:

-- set some time zone
set @@session.time_zone='Asia/Kolkata';  
select concat( concat(if(timestampdiff(hour, utc_timestamp,current_timestamp)>0,'+',''),
timestampdiff(hour, utc_timestamp, current_timestamp)),
':',
MOD(timestampdiff(minute, utc_timestamp, current_timestamp), 60)) as zone_diff from dual;


+-----------+
| zone_diff |
+-----------+
| +5:30     |
+-----------+
user4936563
  • 81
  • 1
  • 4
-1

You can set the default time Zone in PhP. Atfer that you can create an new date object which gives you the time in the TimeZone you set.

date_default_timezone_set("Europe/Berlin");

Look at this for more information: http://php.net/manual/de/function.date-default-timezone-get.php

Tim Jansen
  • 73
  • 10