Hi,
Has someone done this before?
I'm trying to parse string to date.
My input are:
9am
noon
10pm
midnight
Output we're hoping are:
9:00
12:00
22:00
00:00
Thanks in advance for your help
Solved! Go to Solution.
Dear @jmcatch ,
Since Alteryx does not provide a direct formula to convert text into time, we can achieve the desired result using conditional logic within the Formula tool.
I’ve created a workflow to demonstrate this approach. If your text format matches the examples you provided, the included formula should work as expected.
Formula
IF REGEX_CountMatches([Time], "[0-9]") > 0 THEN
DateTimeParse([Time], "%I%p")
ELSEIF Contains([Time], "noon") THEN
DateTimeParse("12pm", "%I%p")
ELSEIF Contains([Time], "midnight") THEN
DateTimeParse("12am", "%I%p")
ELSE
""
ENDIF
Please find the attached workflow for your reference. Let me know if you need any modifications based on different input formats.
Both ways work! Thanks Raj and Amit_G_Limbasia