Alteryx Designer Desktop Discussions

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

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

Archaeopteryx
10 - Fireball

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?

9 REPLIES 9
Thableaus
17 - Castor
17 - Castor

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,

Archaeopteryx
10 - Fireball

Hi

 

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

Thableaus
17 - Castor
17 - Castor

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,

Archaeopteryx
10 - Fireball

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")

 

 

Thableaus
17 - Castor
17 - Castor

@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?

Archaeopteryx
10 - Fireball

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. 

MD2050
8 - Asteroid

hi @Thableaus -

your logic worked superbly !!!

 

Thank you ,md

JORGE4900
8 - 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
RajatRehria
8 - Asteroid

Hi @Thableaus how can i convert this date 05/22/2023 14:16:14 into 05/22/2023 02:16:14 PM using DateTimeParse formula?

Labels