community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE

Converting Time from 1200p to 12PM

Highlighted

Hi there

 

I am somewhat new and would like some help in converting a date which is coming through as a string, for example, 1200p to a time format of HH:MM AM/PM. I have been able to convert to hh:mm using the DateTime tool but not able to pick up the AM/PM part of the string.

 

For clarification 8AM, for example, would come in as 0800a

 

Any help is appreciated.

 

Thanks

 

MJ

Alteryx Certified Partner

How about just using string functions? Try out this formula where [Time] is the input (like "0800a"):

 

IF Right([Time],1)='p' THEN trimleft(Left([Time],2)+"PM",'0')
ELSE trimleft(Left([Time],2)+"AM",'0') ENDIF

Labels