Brian Dunning's FileMaker Custom Functions

GetLocalTimestamp ( Timestamp ; HostTimezone )

Adjust the timestamp to the current user's time zone.

  Be the first to rate this function Log in to vote

Ryan Tayco   Ryan Tayco - Show more from this author
https://www.linkedin.com/in/ryan-tayco-8b9867a7/

  Sample input:
GetLocalTimestamp ( "10/26/2021 9:36:49 AM" ; 8 )
  Sample output:
Chat(Jane's POV):
-----------------------------------
•John on 10/25/2021 6:36:49 PM
says: Hi!

•Jane on 10/26/2021 08:24:15 AM
says: Hello!
-----------------------------------


---
John sent a message at 10/26/2021 9:36:49 AM UTC+11 and at the same time, the server will log John's message at "10/26/2021 6:36:49 AM UTC+8

Jane will see John's message and will show 10/25/2021 6:36:49 PM based on her current time zone, which is UTC-4

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

Description:
This CF adjusts the timestamp created with "Get(CurrentHostTimestamp)" to the user's time zone. "UTCOffset" CF is used to get the user's time zone. Useful when the solution is being shared with users in different time zones.

Note:
Use in a calculation field, field indexing should be unstored.

-------------------------

Format:
GetLocalTimestamp ( Timestamp ; HostTimezone )

Parameters:
Timestamp = Timestamp returned from "Get(CurrentHostTimestamp)".
HostTimezone = Server machine's timezone.

Dependency:
UTCOffset - https://www.briandunning.com/cf/1442

Example:
GetLocalTimestamp ("10/26/2021 9:36:49 AM" ; 8)

Result:
Returns "10/25/2021 9:36:49 PM" if the user's current time zone is -4 and the server timezone is set to 8.

Created by: Ryan Tayco
Date: October 25, 2021

Update 1: by Ryan Tayco on May 16, 2022 - CF description modified.
Update 2: by Ryan Tayco on Feb 23, 2024 - CF name & description modified.
Update 2: by Ryan Tayco on May 14, 2025 - CF name & description modified.

 

Comments

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 21 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: