11-30-2022 04:14 PM
I’m working on creating a few pipelines to transform some data, but I’m having an issue with the date field. The date field I pull is a string and not a date which is the main issue. It’s formatted as MMM 'yy so as an example October 2022 would be formatted as Oct '22. I would like to transform this into an actual date field so that the data is formatted like 10/1/22 instead. The day of month isn’t relevant for this data so any number works there. I’ve been looking around the Snaplogic community, but I can’t find a method that would convert this into a date. Using something like date.parse doesn’t work since it’s not a date field and I wasn’t able to get a type converter snap to work for this. I’ve been manually fixing the dates in Excel and I would like to improve this process going forward since I need to do this monthly. Does anyone have any suggestions on how to get convert this field into a legitimate date?
Solved! Go to Solution.
12-01-2022 07:19 AM
I’m updating the expression:
I’ve tested this one:
Date.parse("Oct '22", "MMM ''yy")
11-30-2022 10:19 PM
Hi @BigUrn,
There’s an option within the Date.parse(), to let the function know the specific format, by passing an additional argument.
If the day is not relevant, you can try something like this:
Date.parse("01 " + $date, "dd MMM 'yy")
12-01-2022 07:19 AM
I’m updating the expression:
I’ve tested this one:
Date.parse("Oct '22", "MMM ''yy")