Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

String conversion of Date of 06JAN15 Impala CDP 7.1.7

avatar
New Contributor

What is the solution:

Field in format: 06JAN15

select cast("06JAN15" as Date Format 'DDMonthRR') from cdx_tmp limit 5;
Query: select cast("06JAN15" as Date Format 'DDMonthRR') from cdx_tmp limit 5
Query submitted at: 2022-10-26 18:34:54 /query_plan?query_id=9d4995eee47d02d8:83582f1400000000
ERROR: UDF ERROR: String to Date parse failed. Invalid string val: "06JAN15"

2 REPLIES 2

avatar
Expert Contributor

Hi @Emiller ! One thing I notice right away about the format string you're trying to use is that "month" works with a full month name rather than an abbreviation. That is, you have "JAN" in your source data, but the "month" format string would work with "January". 

 

I suspect you'll have more luck with something like "DDmonRR". I recommend consulting the documentation on date casts if you need additional help.

avatar
Community Manager

@Emiller Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks


Regards,

Diana Torres,
Community Moderator


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: