Parsing Dates with Different Formats
Answers
-
You can wrap a couple REPLACE functions around your field that replaces the hyphens and periods with slashes followed by the DATE function to format these as date. It would look something like this:
- DATE(
- REPLACE(
- REPLACE(`String`,'-','/')
- ,'.','/')
- )
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
Thanks - that worked for most of the entries - but now all the ones that had 22 as the year vs. 2022 still aren't showing up well. So I'm left with the remaining formats:
- 22-5-20
- 22-2022-05
I thought about doing a replace on 22 to 2022 but I'm afraid that will impact 5/22/2022 items.
0 -
Can you post your formula? Wrapping the DATE function around everything should normalize the years.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
DATE(
REPLACE(
REPLACE(`Interview Scheduled Date`,'-','/')
,'.','/')
)
0 -
Actually the dataset errored out - let me investigate further.
0 -
It keeps erroring out noting "Failed to convert value '005/27/22' from type 'String' to type 'Date'."
I then added to your formula
DATE(
replace(REPLACE(
REPLACE(`Interview Scheduled Date`,'/','-')
,'.','-'),'00','0')
)
But I got this result, "Failed to convert value '05-27-22' from type 'String' to type 'Date'."
0 -
See how close this gets you:
- DATE(
- REPLACE(
- REPLACE(
- REPLACE(`Interview Scheduled Date`,'00','')
- ,'-','/')
- ,'.','/')
- )
This still might not work for 100% of your data because it seems like you have rows with 2 digit years in different spots and Domo won't know if that is a year or a day. You might need to try and thinking about incorporating a case statement as well and performing different logic based on certain conditions.
**Check out my Domo Tips & Tricks Videos
**Make sure toany users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
Got it - I will look at the case logic - from your last note - I got the following error:
"Failed to convert value '22/04/18' from type 'String' to type 'Date'."
0 -
I think the logic is helpful enough - I think I will have to add some data validation to the front end.
0
Categories
- All Categories
- 1.9K Product Ideas
- 1.9K Ideas Exchange
- 1.6K Connect
- 1.3K Connectors
- 305 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 3K Transform
- 111 SQL DataFlows
- 649 Datasets
- 2.2K Magic ETL
- 4K Visualize
- 2.5K Charting
- 783 Beast Mode
- 76 App Studio
- 43 Variables
- 739 Automate
- 186 Apps
- 474 APIs & Domo Developer
- 65 Workflows
- 14 DomoAI
- 40 Predict
- 17 Jupyter Workspaces
- 23 R & Python Tiles
- 406 Distribute
- 117 Domo Everywhere
- 279 Scheduled Reports
- 10 Software Integrations
- 138 Manage
- 135 Governance & Security
- 8 Domo Community Gallery
- 44 Product Releases
- 12 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 113 Community Announcements
- 4.8K Archive