Brian Dunning's FileMaker Custom Functions

UTC2Local ( UTC ; Timezone ; Decimals )

Convert a UTC-milliseconds time into a local time corrected for DST.

  Average rating: 5.0 (1 vote) Log in to vote

Menno van Beek   Menno van Beek
Van Beek Zakelijke Software
https://www.vbzs.nl

Share on Facebook Share on Twitter

  Sample input:
UTC2Local ( Get ( CurrentTimeUTCMilliseconds ) ; 1 ; 3 )
  Sample output:
31-08-2018 12:26:33,250

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Convert a UTC-milliseconds time (or number) into a local time corrected for DST. If your area or the particular area you calculate the timestamp for does not use DST, it's easy to change the formula a bit by adding an extra parameter.
for example: UTC2Local ( UTC ; Timezone ; Decimals ; use_dst ) and change the part "dst = If ( utc ≥ dst0 and utc < dst1 ; 3600 )" into "dst = Case ( not ( use_dst ) ; 0 ; utc ≥ dst0 and utc < dst1 ; 3600 )" and enter 1 if you do want to correct for DST

 

Comments

Menno van Beek   Menno van Beek, Van Beek Zakelijke Software
Sep 1, 2018
EDITED the formula: Corrected a little issue in the DST correction. The previous version would calculate an incorrect result when the last day of the given month is on a Sunday. The first occurrence would have been on March 24 2019
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.