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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive