Thu Sep 19, 2019 3:13 pm
Login Register Lost Password? Contact Us


GMT to EST conversion in Version 7.2.28

Comments and questions related to the Enterprise Control Language

Wed Aug 21, 2019 12:43 pm Change Time Zone

Hi,

What is the best way to convert time from GMT to EST in ECL version 7.2.28.1?

There is a built-in function, which converts the given input time(in Time_t format) to the required TimeZone as given below

Code: Select all
IMPORT STD;
STD.Date.TimeZone.AdjustTimeTZ(155026,'GMT','EST','','');

//output : 105026


But how can we get the actual converted time wrt Daylight Savings as we are not giving any specific date as input to the function?
Anustiya
 
Posts: 1
Joined: Wed Aug 21, 2019 12:27 pm

Wed Aug 21, 2019 7:29 pm Change Time Zone

Daylight savings is a very complicated issue, as its observance varies by both geography and local laws. Geography isn't part of the Std.Date.TimeZone module, so there is not a way of automatically determining if DST should be included or not.

There is a single function that can tell you if DST may be if effect: Std.Date.IsLocalDaylightSavingsInEffect(). However, its return value is only for the current date/time and is determined by the time zone set in the HPCC Systems cluster's operating system; it also does not take into account geography or local laws, nor does it allow you to determine DST for a random date/time.

If you can make a determination regarding DST prior to calling Std.Date.TimeZone.AdjustTimeTZ(), you can adjust your arguments to switch between 'EST' or 'EDT' for the toTimeZoneAbbrev parameter. Note that in some cases you need to supply a toLocation argument as well to differentiate between time zones with the same abbreviation (e.g. 'CST').

Hope this helps.

Dan
DSC
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 562
Joined: Tue Oct 18, 2011 4:45 pm


Return to ECL

Who is online

Users browsing this forum: Bing [Bot] and 0 guests