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 - Show more from this author
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.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.