Failure to parse date/time
Best Answers
-
@LeonN The %d specifier in the DATE_FORMAT function is expecting a leading zero in the day, so it is expecting 'Jan 01, 23' instead of 'Jan 1, 23'. You may need to manipulate the field to include a leading zero before the day before using the DATE_FORMAT function. Alternatively you could try using the FUZZY_PARSE_DATE function instead of DATE_FORMAT.
0 -
You should be able to use
%e
instead of%d
for the day part to account for the day not being provided in the 2 digits format, and remember to use STR_TO_DATE and not the DATE_FORMAT function, as what you have is a string you want to turn into a date and not displaying a date in a specific string format. I just tested my previous suggestion and seems to be working for me:STR_TO_DATE(`Year Day Month (text)`,'%b %e, %y')
I have doubts as in the original post you mentioned having a column called
Year Month Date (text)
based on your ETL screenshot, but in the table screenshot you're showing the dates to be column names and a column each. What is it that you're trying to achieve? What does your ideal output look like (I doubt you want to have a separate column per each date) and what does your current input look like?0
Answers
-
Jan 1, 23; Jan 2, 23 etc. (see column names below)
0 -
Based on the error in red, it seems your date string includes a comma after the day number and this one is using a single digit version when below day 10, this could be the reason it fails. Try updating your date format to:
STR_TO_DATE(`Year Day Month (text)`,'%b %e, %y')
0 -
You need to add a comma to your date format:
DATE_FORMAT(`MyDateColumn`, '%b %d, %y')
For others who come across this there's a great Domo KB article on date format string you can find here:
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
I did try adding a comma and I'm still getting the same error.
0 -
It also seems like you have some slashes before and after your date. I would try adding a REPLACE function to remove those and then convert to date.
REPLACE(fieldname,'/','')
**Check out my Domo Tips & Tricks Videos
**Make sure to any users posts that helped you.
**Please mark as accepted the ones who solved your issue.0 -
Thanks for the suggestions, but still not having any luck
0 -
@LeonN The %d specifier in the DATE_FORMAT function is expecting a leading zero in the day, so it is expecting 'Jan 01, 23' instead of 'Jan 1, 23'. You may need to manipulate the field to include a leading zero before the day before using the DATE_FORMAT function. Alternatively you could try using the FUZZY_PARSE_DATE function instead of DATE_FORMAT.
0 -
You should be able to use
%e
instead of%d
for the day part to account for the day not being provided in the 2 digits format, and remember to use STR_TO_DATE and not the DATE_FORMAT function, as what you have is a string you want to turn into a date and not displaying a date in a specific string format. I just tested my previous suggestion and seems to be working for me:STR_TO_DATE(`Year Day Month (text)`,'%b %e, %y')
I have doubts as in the original post you mentioned having a column called
Year Month Date (text)
based on your ETL screenshot, but in the table screenshot you're showing the dates to be column names and a column each. What is it that you're trying to achieve? What does your ideal output look like (I doubt you want to have a separate column per each date) and what does your current input look like?0
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 292 Workbench
- 4 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 95 SQL DataFlows
- 603 Datasets
- 2.1K Magic ETL
- 3.7K Visualize
- 2.4K Charting
- 697 Beast Mode
- 43 App Studio
- 39 Variables
- 658 Automate
- 170 Apps
- 441 APIs & Domo Developer
- 42 Workflows
- 5 DomoAI
- 32 Predict
- 12 Jupyter Workspaces
- 20 R & Python Tiles
- 386 Distribute
- 111 Domo Everywhere
- 269 Scheduled Reports
- 6 Software Integrations
- 113 Manage
- 110 Governance & Security
- 8 Domo University
- 30 Product Releases
- Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 98 Community Announcements
- Domo Community Gallery
- 4.8K Archive