Skip to main content
Solved

Time from DATE_FORMAT() is incorrect

  • August 9, 2022
  • 2 replies
  • 22 views

Cody_Winchester
Forum|alt.badge.img+12

I’m have some datetime fields that I’m trying to format down to isolate the time. However, I’m seeing that there are some glitches with how the time renders based on time zone. My source datetime field is formatted to PDT, but the output appears to be GMT. I don’t see a way to correct this because switching the datetime field to GMT for all collaborators produces bogus times that cannot be used for local dates. Is there an operator to add in the formula that corrects the glitch from the source datetime field, or is there a way to “lock-in” the time in the base so that GMT doesn’t muck things up?

Best answer by kuovonne

You need to use SET_TIMEZONE().It is documented in the Formula Field Reference.

DATETIME_FORMAT(
    SET_TIMEZONE({Session 00 Start Time}, 'America/Los_Angeles'),
    'LT'
)

2 replies

kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • Answer
  • August 9, 2022

You need to use SET_TIMEZONE().It is documented in the Formula Field Reference.

DATETIME_FORMAT(
    SET_TIMEZONE({Session 00 Start Time}, 'America/Los_Angeles'),
    'LT'
)

Cody_Winchester
Forum|alt.badge.img+12
  • Author
  • Inspiring
  • 27 replies
  • August 9, 2022

You need to use SET_TIMEZONE().It is documented in the Formula Field Reference.

DATETIME_FORMAT(
    SET_TIMEZONE({Session 00 Start Time}, 'America/Los_Angeles'),
    'LT'
)

Exquisite! Thanks @kuovonne!