Parse Date Time Tool -- can it specify AM/PM ?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
HI,
Can I have the tool to know whether the date/time read in is either AM or PM?
AM or PM designation?
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Do you really have to use the DateTime tool?
Using the DateTimeParse function, you can specify AM/PM with the "%X" parameter.
Cheers,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi
and thank you for the reply. Can you elaborate? 'How' to use the %X parameter? I have Particle status.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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?
