Skip to main content

Formula field as date field

  • July 20, 2022
  • 2 replies
  • 13 views

Forum|alt.badge.img+9

I have a formula field as follows:

DATETIME_FORMAT(DATETIME_PARSE(RIGHT({Webhook Data},20), ‘^DD/MM/YYYY HH:mm^’), ‘DD-MMM-YYYY HH:mm’)

But it returns a string - Is there an easy way for this same formula to return. date/time field that I can use for sorting please?

2 replies

Kamille_Parks11
Forum|alt.badge.img+27

Yep. DATETIME_FORMAT’s sole purpose is to turn a date into a string. The purpose of DATETIME_PARSE is to turn a string into a date.

So your formula as written says “take this string, turn it into a date, then turn it back into another string”. You instead want:

DATETIME_PARSE(RIGHT({Webhook Data},20), 'DD/MM/YYYY HH:mm')

Forum|alt.badge.img+9
  • Author
  • Inspiring
  • 39 replies
  • July 21, 2022

Yep. DATETIME_FORMAT’s sole purpose is to turn a date into a string. The purpose of DATETIME_PARSE is to turn a string into a date.

So your formula as written says “take this string, turn it into a date, then turn it back into another string”. You instead want:

DATETIME_PARSE(RIGHT({Webhook Data},20), 'DD/MM/YYYY HH:mm')

Funny how it is so obvious when someone points it out to you! Thanks.