Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Check out our powerful new search update! You can read more here. Please let us know if you have any feedback by creating a topic here.

Parse Date Time Tool -- can it specify AM/PM ?

Highlighted
Asteroid

HI,

 

Can I have the tool to know whether the date/time read in is either AM or PM?

 

AM or PM designation?AM or PM designation?

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @Archaeopteryx

 

Do you really have to use the DateTime tool?

 

Using the DateTimeParse function, you can specify AM/PM with the "%X" parameter.

 

Cheers,

Highlighted
Asteroid

Hi

 

and thank you for the reply. Can you elaborate? 'How' to use the %X parameter? I have Particle status. 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Example: String date as 05/12/2018 01:45 AM

 

DateTimeParse([Field1],"%d/%m/%y %I:%M %p")

 

%I for hours to 00 to 12, %M for minutes and %p to AM/PM.

 

You can have a list of parameters here in this link: https://help.alteryx.com/9.5/Reference/DateTimeFunctions.htm

 

Cheers,

Highlighted
Asteroid

Here are screen shots of what I have. I'm not sure where I'd provide your function. I tried it with [Received 2],but [Received 2] was null. I only tried using the part of the function that is associated with the time, "%I:%M: %p" I'm assuming that first alpha is "I" as in Indigo? I set up the formula like this: DateTimeParse([Received 2],"%I:%M: %p")

 

 

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

@Archaeopteryx

 

Not so sure what you're trying to do, but to Parse the field, you need a date. You can't just use time itself. You can use either a date, or a date/time format.

What exactly are you trying to accomplish, could you be more specific?

Highlighted
Asteroid

Thank you for your time and help. Here is what I did. See Screen shot. I cannot figure out how to add a literal "AM" or "PM" to the time, so, we infer it with military time. See the formula. 

Highlighted
Asteroid

hi @Thableaus -

your logic worked superbly !!!

 

Thank you ,md

Highlighted
Asteroid

Hello there @Archaeopteryx and @Thableaus 

 

Touching again on this subject, here is a sample of how to parse date time coming in 12 hour format with the AM/PM specifier; please note that when the specifier is on PM, it adds 12 hours to the parsed date time.

 

I guess that the key to it is to use the %I and %P specifiers on the format side of the formula's parameters.

 

Spoiler
2019-08-26_15-37-37.jpg
Labels