Friday, May 10, 2019

Add Hours or Minutes to Time of Day Fields

Use Case

  • User's Time Zone is set to (GMT-05:00) Eastern Time (US & Canada)
  • User would like to create custom fields that will automatically display the current time of day in several other time zones, e.g. (GMT+08:00) Taipei, (GMT+10:00) Brisbane, etc.


Hours in Time of Day fields are evaluated as 24:1. To add or deduct exact hours from a field that computes the time of day, user must divide the value by 24.

In the above example, the current time in Taipei and Brisbane can be computed by adding the time difference of each city to US & Canada Eastern Time, that is +12hours and +14hours, respectively.

To create the custom fields:

1. Navigate to Customization > Lists, Records, & Fields > select the type of custom field e.g. Entity > New.

2. Provide a Title.

3. Set Type to Time of Day.

4. Set Store Value to False.

5. Set other settings as needed (Apply To and Display tabs). 

6. Under Validation & Defaulting, set Default Value to

  • {today}+12/24        >> for Taipei
  • {today}+14/24        >> for Brisbane

7. Click Save.


Notes:

  • Daylight Saving Time (DST) impacts the computations in the above example
  • To add portions of an hour in a Time of Day field, e.g. 30 minutes, add 1/48 to the formula.

No comments:

Post a Comment