The following expression,
TalendDate.parseDate("yyyy-MMM-dd HH:mm:ss", "23-Mar-1979 23:59:59")
gives me the output:
Fri Jul 30 23:59:59 CET 28
I wonder why is it giving me such an output.
OS: Windows XP
Current Locale: Sweden
Talend ETL : 2.3.1
Hi Umair,
You try to parse a Date with a String value but a wrong DatePattern.
When you parseDate you need to have the same Pattern for your String value to parse in a Date object your data.
Best regards;
The example, TalendDate.parseDate("yyyy-MMM-dd HH:mm:ss", "23-Mar-1979 23:59:59")
is quoted in TalendDate routine comments.
But, now i changed the values and tried with the updated params:
TalendDate.parseDate("yyyy-mm-dd HH:mm:ss", "1979-04-11 23:59:59")
It now gives :
Thu Jan 11 23:59:59 CET 1979
The month is displayed as something else
Hi, I have a date in following format. Tue Nov 01 12:36:40 GMT+05:30 2011 I tried to parse it using following statement in tJava component TalendDate.parseDate("yyyy-mm-dd HH:mm:ss",input_row.mtime_string); This input_row.mtime_string string comes from tfileProperties. It returns following exception Exception in component tJavaRow_1 java.lang.RuntimeException: java.text.ParseException: Unparseable date: "Tue Nov 01 12:36:40 GMT+05:30 2011" Whether am in missing something ? Vaibhav
Hi,
Solution to above query is following expression.
TalendDate.formatDate("yyyy-mm-dd hh:mm:ss",TalendDate.parseDate("EEE MMM dd HH:mm:ss Z yyyy","Tue Nov 01 12:36:40 GMT+05:30 2011"))
Contributed by Diwakar Nahata.
Thanks
Vaibhav
Hi All, TalendDate.ParseDate function in Talend to convert into Date Data type returns date in date data type but the date patterns is something else which is unexpected . for eg. I want to convert following string into date data type. TalendDate.ParseDate("MM/dd/yyyy","09/18/2013") The Above function returns me the date in date data type but the format of that is like "18-SEP-2013" I want the output in "MM/dd/yyyy" means "09/18/2013" formats only. can anyone suggest me how to overcome this issue. Thank you in advance. with kind regards, Shailendra S.