Let’s talk Alteryx Copilot. Join the live AMA event to connect with the Alteryx team, ask questions, and hear how others are exploring what Copilot can do. Have Copilot questions? Ask here!
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

parsing text to date

jmcatch
5 - Atom

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

 

3 REPLIES 3
Amit_G_Limbasia
9 - Comet

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.

Raj
16 - Nebula

please find attached

mark done if solved.

jmcatch
5 - Atom

Both ways work! Thanks Raj and Amit_G_Limbasia

Labels
Top Solution Authors