Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sudhee
Contributor
Contributor

issue with date conversion in parse date from 2018-10-01 00:00:00 to yyyyMMdd

I have to convert string format which is in this format coming from oralce input "2018-10-01 00:00:00"    to yyyyMMdd string or number format .
when i use below code in talend tjavarow ,
System.out.println(TalendDate.parseDate("2018-10-01 00:00:00","yyyyMMdd"));

 

it throws an error  as

local_project.test_date_functions_0_1.Test_date_Functions - tJavaRow_1 java.text.ParseException: Unparseable date: "yyyyMMdd"local_project.test_date_functions_0_1.Test_date_Functions - tJavaRow_1 java.text.ParseException: Unparseable date: "yyyyMMdd"Exception in component tJavaRow_1java.lang.RuntimeException: java.text.ParseException: Unparseable date: "yyyyMMdd" at routines.TalendDate.parseDate(TalendDate.java:889) at routines.TalendDate.parseDate(TalendDate.java:833) 

can someone help me on this 

Labels (3)
1 Reply
Anonymous
Not applicable

Your code has two errors: (1) you have reversed the two arguments (i.e. the date to parse is the second argument, not the first); (2) the date format string doesn't include the timestamp, while the date you are parsing does. Here is an example from Talend's Help Center:

https://help.talend.com/reader/H~ouYvKTrzr7kXU4N4rcpA/~VB3H3cm80qc7OIB~ySwWA