Alteryx Designer Desktop Discussions

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

Error: "Not a valid datetime"

Pankhudri20
8 - Asteroid

Hello,

 

I have created a field Date_C7_Alert2 which takes datetime from an existing field 'logdate'.

Date_C7_Alert2 is datetime type.

However, I get warnings like these.

Pankhudri20_0-1627413279014.png

How can I remove these warnings?

 

Thank you

Regards,

Pankhudri

11 REPLIES 11
Luke_C
17 - Castor

Hi @Pankhudri20 

 

Can you share more of the configurations of the tools? MM/DD/YYYY is not a valid date format, so you would need to either use a datetime tool or datetimeparse formula to convert it. My suspicion is you are trying to just update the datatype of a field with this data which wouldn't work. Alteryx needs to know how to convert the string to the datetime format (YYYY-MM-DD)

 

 

Pankhudri20
8 - Asteroid

Hello @Luke_C ,

 

Thank you for your response.

Can you tell me how to use the datetimeparse formula to convert the data type but keep the same format?

 

Regards,

Pankhudri

JagdeeshN
12 - Quasar
12 - Quasar

Hi @Pankhudri20 ,

 

Can you please share a list of sample dates that you are looking to parse.

 

Best,

Jagdeesh

apathetichell
18 - Pollux

logdate is not a datetime file in Alteryx... Your error message says that. It says the format is

mm/dd/yyyy H:M:S AM...

 

You need to convert the H to a 24 hour cycle and drop the AM/PM...  Post some data and it can be fixed.

@Luke_C @JagdeeshN  - I've never used %i and %P in datetimeparse - have you?

 

format has to be:

YYYY-mm-dd H:M:S

Luke_C
17 - Castor

Hi @Pankhudri20 

 

 

Here's two examples based on your screenshot:

 

datetimeparse([Field1],'%m/%d/%Y %I:%M:%S %p')

 

Luke_C_0-1627415670169.png

 

JagdeeshN
12 - Quasar
12 - Quasar

Hi @Pankhudri20 ,

 

I think @Luke_C 's sample workflow should do the conversion for you.

 

Like @apathetichell mentioned, one part of it is because of the AM/PM - 12/24hr cycle.

 

Best,

Jagdeesh

apathetichell
18 - Pollux

@Luke_C- nice!

Pankhudri20
8 - Asteroid

Hello,

 

Thank you for your response everyone.

I have this workflow.

I tried adding Luke's solution but it still doesnt convert

Pankhudri20_0-1627424278911.png

I do parse the logdate field and the new field is datetime 

But I still get these warnings.

What am I doing incorrect here?

 

Regards,

Pankhudri

 

apathetichell
18 - Pollux

your else statement is pointing to your current field. Your current field is not datetime. this creates an error. You do not need this else statement.

 

let's pretend your [current field] says "True"... your if statement says if "True" then 1. You else says [current field]. "False" is not an integer so this creates an error.

Labels