Brian Dunning's FileMaker Custom Functions

AdjustHostTStoLocalTS ( HostTimestamp_field ; ServerTimeZone )

Virtually auto-adjust the host timestamp to 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/

Share on Facebook Share on Twitter

  Sample input:
AdjustHostTStoLocalTS ( "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)

Note:
This CF virtually converts the "Get(CurrentHostTimestamp)" field value to the current user's time zone. "UTCOffset" CF is used to get the current user's time zone. Useful when you are working with people from different time zones to see when they created or updated a record. Very good use for "Comments" and "Chat" databases.

Note2:
To use in a calculation field, indexing should be unstored.

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

Format:
AdjustHostTStoLocalTS ( HostTimestamp_field ; ServerTimeZone )

Parameters:
HostTimestamp_field = Your calculated HostTimestamp Field[Get(HostTimestamp)].
ServerTimeZone = Server Computer's timezone.

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

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

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

Created by: Ryan Tayco on OCT 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.

 

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