Converting YYYYMMDD String to a Date YYYY-MM-DD but getting a NULL
- 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 am trying to convert a string field to a specific date format. After reviewing previous posts and trying several examples provided, I am still seeing nulls returned.
The string field I need to convert has a couple of different formats of the data, so I am using a Text to Columns tool to isolate the string of data I need. When adding the formula tool to create a new date field it is returning null.
ToDate(datetimeformat([DOS1],'%Y-%m-%d'))
I have also tried using the DateTime tool to convert string to date with yyyy-MM-dd format but that is also returning null.
See attached workflow to view the current data coming in and the expected output.
Example Input:
20221201
20221202-20221203
Expected Output:
2022-12-01
2022-12-02
Solved! Go to Solution.
- Labels:
- Date Time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thanks for the fast replies!! I had a light bulb moment after I posted this question and figured it out. I used: DateTimeFormat(DateTimeParse([DOS1],'%Y%m%d'),'%Y-%m-%d')
and no more nulls!
Date Time Parse was the key :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My data comes in as mmddyyyy (vstring). I've tried using all of the examples for an input string that arrives as yyyymmdd in various ways and nothing works. I still get a null value. Does anyone have a solution for converting from mddyyyy format?
