Converting datetime format for multiple columns
- 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
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?
Solved! Go to Solution.
- Labels:
- Common Use Cases
- Datasets
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
ahh that worked beautifully! Thank you!
