- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
String conversion of Date of 06JAN15 Impala CDP 7.1.7
Created on 10-26-2022 03:48 PM - edited 10-26-2022 06:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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"
Created 10-31-2022 12:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created 11-03-2022 01:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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:
