12 PM/AM String to DateTime Node logic is backwards

I believe the String to Date&Time node has the logic backwards, for 12PM is returning 00 and for 12AM is returning 12. In the below screenshot 12:25 PM should be converted to 12:25 and 12:03 AM should be converted to 00:03

Sample data:
9/10/2020 12:25:00 PM
9/11/2020 12:03:00 AM

image

image

It is also shifting the date from 9/10/2020 to 9/11/2020 (first example 9/10/2020 12:25:00 PM)

@Alejandroc, how are you configuring the node?

I get the expected result:

image

Here @elsamuel : image

would you mind sharing your workflow?

Why are you using “K” in your time format?

I’m having a hard time converting those dates and saw this post
image

using your configuration I get this message
ERROR String to Date&Time 0:461 Execute failed: Failed to parse date in row 'Row0: Text ‘1/21/2020 4:16:00 PM’ could not be parsed at index 10

Here’s a data sample:
DateTime_Data.xlsx (13.3 KB)

That’s because the examples you initially shared had double digit hours.

Now you’ve changed things and want to be able to use single digit hours, you’ll need to use h instead of hh

2 Likes

aah that makes sense. I ended up using this M/d/yyyy h:mm:ss a and it worked.

Thanks a lot @elsamuel

image

1 Like

Hi @Alejandroc , it’s great that you got the right format, but hopefully you also learned from the few back and forth with @elsamuel and understood how the formatting works, and not just going by with uneducated trial and error.

It’s not too difficult to understand the format:
M is for Month, in single digit representation (for example 9, or 12)
MM is for month, in double digits representation (for example 09 or 12)

d is for day, in single digit representation (for example, 2 or 18)
dd is for day, in double digits representation (for example, 02 or 18)

etc…

4 Likes

Yep, understood. Thanks for the additional details. :+1:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.