time.UTCtoLocal ( theTimeStamp ; ZoneOffset ; ObservesDST )
Converts UTC timestamp to local time DST adjusted
Average rating: 4.3 (3 votes) Log in to vote
Rob Poelking - Show more from this author
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Takes UTC (GMT) time stamp and converts it to local time assuming the correct time zone offset in hours +/-h and whether or not the local area observes Daylight Saving. The start and end dates for daylight saving may need to be adjusted for locale outside of the U.S.
Depends on function written by Koji Takeuchi, Splash, Inc. for the DateByNthDOW function.
|Dan Fries, Daniel Fries Music
Aug 20, 2019
|Thank you for this work. I just put it into my solution with a slight modification, so that it returns the utc offset of a given date and time, I'm using it to send .ics files via email.
* offset.DST ( theDate ; theTime; ZoneOffset ; ObservesDST )
* theDate Input Date
theTime Input time
* ZoneOffset (num) basic time zone offset in hours ignoring DST
* ObservesDST (bool) True, area observes DST. Leave false if the local area does not observe DST
* UTC offset of given date and time
* DateByNthDOW - Koji Takeuchi, Splash, Inc. https://www.briandunning.com/cf/1282
* Use to convert UTC time stamps to local time
* Adjust DST dates for your local zone. DST = Daylight Saving Time
* 2017-07-13 Rob Poelking - Initial Release
~offset = GetAsNumber (ZoneOffset) ;
~dateLocal = GetAsDate ( theDate ) ;
~timeLocal = GetAsTime ( theTime ) ;
~dstStart = DateByNthDOW ( Year(~dateLocal) ; 3 ; 1 ; 2 ) ; /* 2nd Sunday in March */
~dstEnd = DateByNthDOW ( Year(~dateLocal) ; 11 ; 1 ; 1 ) ; /* 1st Sunday in November */
~dst = GetAsBoolean ( ObservesDST ) ;
~dateLocal < ~dstStart ; False ;
~dateLocal > ~dstEnd ; False ;
~dateLocal = ~dstStart and ~timeLocal < Time ( 2;0;0) ; False ;
~dateLocal = ~dstEnd and ~timeLocal > Time (1;0;0) ; False ;
/* observes DST */
If (~isDS and ~dst ; ~offset + 1; ~offset)
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.