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

Alteryx designer Discussions

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

Convert String to DateTime

Meteor

Hi , 

 

I would like to convert String to Date Time .For an example ,

 

 

Input      10/6/17 12:00 PM (String type)

Output  10/6/17 12:00 PM(DateTime Type)

 

I try using the Datetime tool but the outcome :2017-01-06 12:00:00

 

It is almost correct but the AM/PM is not appearing.

 

Thank You.

You will need to use a formula tool to cope with the AM/PM I think.

 

An expression:

DatetimeParse([StringDate],"%m/%d/%Y %I:%M %p")

should work

 

The output DateTime format will be in YYYY-MM-DD HH:mm:ss format as that is how Alteryx stores dates

 

Sample attached

The key part here is the parameter characters are case sensitive. Y for year , m for month and d for day which I ignored and struggled for sometime.

Labels