Problems with time zone, summertime not shown

Problems with time zone, summertime not shown

by Dieter D. -
Number of replies: 1

Hi,

using the time zone handling function, I get wrong results.

My Moodle site has got these entries for Europe/Berlin

938,Europe/Berlin,1970,Germany,60,0,4,10,-1,0,03:00,10,1,0,0,03:00

939,Europe/Berlin,1980,EU,60,60,4,1,0,0,1:00,9,-1,0,0,1:00

940,Europe/Berlin,1981,EU,60,60,3,-1,0,0,1:00,9,-1,0,0,1:00

941,Europe/Berlin,1996,EU,60,60,3,-1,0,0,1:00,10,-1,0,0,1:00


Although we currently HAVE summertime in Germany (CEST=UTC+2), the functions return only one hour offset instead of two:

get_user_timezone()   Europe/Berlin

get_timezone_offset(get_user_timezone()) 3600


For sure the problem is sitting in front of the screen smile ... but what's my mistake?


Best regards, Dieter

PS: Moodle itself is displaying the time correctly (e.g. admin->report->logs->timestamp of most recent activity)



Average of ratings: -
In reply to Dieter D.

Re: Problems with time zone, summertime not shown

by Dieter D. -

Hi, found my mistake. I need to sum up the general offset AND the daylight saving offset, e.g.:

get_timezone_offset("Europe/Berlin")+dst_offset_on(time(),"Europe/Berlin")