Hi everyone,
I'm getting an error in this formula tool within an IF statement and I'm not sure what's needed to correct the expression. Any ideas?
IF Contains([Join Time],'PM' OR 'AM')
THEN [Join Time]
ELSE DateTimeParse([Join Time],"%m/%d/%Y %k",)
ENDIF
Solved! Go to Solution.
@kceesay Can you show an example of what your data looks like coming into the Formula tool?
Splitting your test clause might help:
IF Contains([Join Time], "PM") OR Contains([Join Time], "AM") THEN ...
@Prometheus The column contains data like the below. I want to standardize the formatting.
08/29/2023 03:02:51 PM
08/29/2023 03:15:20 PM
08/29/2023 03:46:57 PM
8/17/2023 9:45
8/17/2023 9:54
8/17/2023 9:54
@ed_hayter I tried breaking it up, but I think the issue may be in another part of the expression. I've attached a screenshot.
@kceesay try this
It parses the date times without AM, PM then wrapped in a datetimeformat to return a string with the same date structure as you already have in your data
@kceesay you can give this a try:
IF Contains([Join Time], 'PM') OR Contains([Join Time], 'AM')
THEN [Join Time]
ELSE DateTimeParse([Join Time], "%m/%d/%Y %H:%M")
ENDIF
@ed_hayter That worked thank you so much!