DateTimeParse does not parse leading two digit year
- 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
I have a string yymmdd and the datetimeparse formula is not parsing the leading two digit year. Please see details below;
Input:
Field 1 |
180118 |
Formula: DateTimeParse([Field1],"%y%m%d")
Conv Error: DATETIMEPARSE: Cannot convert "180118" to a date/time with format "%y%m%d": Month number is out of range 1..12: '18'
Any thoughts what is going wrong here?
Solved! Go to Solution.
- Labels:
- Date Time
- Error Message
- Parse
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Part of the issue revolves around how Alteryx recognizes two digit years.
Try separating each section via a formula and then use the todate() function. You can also concatenate "20" to the beginning of your string and then use your conversion formula.
todate("20" + left([Field 1],2) + "-" + right(left([Field 1],4),2) + "-" + right([Field 1],2))
DateTimeParse(("20" + [Field 1]),"%y%m%d")
See attached for an example. Let me know if that works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Similar to the route @echuong1 wen't down i would add 20 in front of the string and use the DateTimeParse() function:
DateTimeParse('20' + ToString([Field 1]),'%y%m%d')
If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.
Regards,
Jonathan
