SOLVED
How to Use Date Convert across 20th and 21st Century
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
pennylaf
5 - Atom
‎04-07-2017
08:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello! I have a monthly data set that starts in Jan-92 and goes through Dec-16. The data is coming in as a V-String and I am converting to a date by using DateTimeParse "%b-%y" and then DateTimeTrim 'lastofmonth' to convert to a Month End Date. All my dates in the 1990's are converting as 2090's. Any suggestions on how to make the dates look at the previous Century and not into the future?
Solved! Go to Solution.
Labels:
- Labels:
- Date Time
3 REPLIES 3
20 - Arcturus
‎04-07-2017
10:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is one way to skin that cat!
IF toNumber(RIGHT([Date],2)) < 18 THEN DateTimeFormat( DateTimeTrim( Datetimeformat( DateTimeParse( Replace([Date],"-","-20"),"%b-%Y"), "%Y-%m-%d"), "lastofMonth") ,"%Y-%m-%d") ELSE DateTimeFormat( DateTimeTrim( Datetimeformat( DateTimeParse( Replace([Date],"-","-19"),"%b-%Y"), "%Y-%m-%d"), "lastofMonth") ,"%Y-%m-%d") ENDIF
Cheers,
Mark
Alteryx ACE & Top Community Contributor
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
‎04-07-2017
11:06 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Beautiful! Thank you!
alex
11 - Bolide
‎04-07-2017
11:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Different solution if your data will never start prior to the 1992 date.
