Alteryx Designer Desktop Discussions

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

Converting datetime format for multiple columns

mystasz
8 - Asteroid

Hello,

 

I have about 6 columns that contain datetime values that look like this:

2022-05-03 07:47:00
2022-05-03 12:04:00
2022-05-03 16:10:00

 

I'd like to change the format for all columns at once to something like this "05-03-2022 7:47 AM". I used the multi-field formula and applied this expression:

Datetimeparse([_CurrentField_],'%m-%d-%y %I:%M:%S %p')

 

The error I'm getting is:

"Type mismatch. Number provided where a string is required."

 

Overall i'm getting this error when I run it: 

ConvError: Multi-Field Formula (138): DATETIMEPARSE: Cannot convert "2022-05-03 14:25:00" to a date/time with format "%m-%d-%y %I:%M:%S %p" and language "English": Month number is out of range 1..12: '2022-05-03 14:25:00'

 

What am I doing wrong? 

 

 

2 REPLIES 2
Luke_C
17 - Castor

Hi @mystasz 

 

I'm not sure why the type mismatch is appearing, but it doesn't seem to impact the workflow running. You just need to use DateTimeFormat instead of DateTimeParse. Parse is for text>date, format is for date>text.

 

Also be sure to update the field to be a string of the appropriate size.

 

Luke_C_0-1651684611209.png

 

 

mystasz
8 - Asteroid

ahh that worked beautifully! Thank you!

Labels