Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

DateTime Parse Help!

wiseman_21
5 - Atom

how should i go about update the string "Wed 1Sep21 00:09:06 am" to "Wed 1Sep21 12:09:06 am" ? Ultimately i need the date to be in the format of mm-dd-yy hh:mm:ss (24 hours)

 

Tried DateTImeParse but it is throwing range error on hours because the formula I used requires the hour element in the string to be in good format (i.e. 1-12) DateTimeParse([string],"%a %d%b%y %I:%M:%S %P")

 

wiseman_21_0-1642041898615.png

 

THank you ! 

4 REPLIES 4
gabrielvilella
14 - Magnetar

If you have midnight as 00, this is already on the 24h format, don't actually need the am at the end. And even the day of the week you can get rid of.

Try this one: DateTimeParse(Substring([Field1],4,15),"%d%b%y %H:%M:%S")

wiseman_21
5 - Atom

sry my data is that clean - might need this "00" to "12" enrichment so that datetimeparse can actually work. Is there any other alternatives ?

gabrielvilella
14 - Magnetar

See the workflow attached.

atcodedog05
22 - Nova
22 - Nova

Hi @wiseman_21 

 

My take on this. Even if hr is in 1-12 or "00"-"12" it should still work.

 

Workflow:

atcodedog05_0-1642052478424.png

 

Hope this helps : )

Labels