One Star

Date format conversion

I am getting "dd-mon-yyyy" from my input csv file & want to parse this date & want to punch this value of date into my database in format of "mm-dd-rrrr hh:mi:ss".How to parse this date & convert it.Please help.Thanks in advance.
Seven Stars

Re: Date format conversion

If the field in the database is a date, it doesn't have a format as such. The format is just how you view it, not how it's stored. So all you need to do is correctly read the value from the input file as a date and pass that to the database. To do that, set the column in the input file schema to a date with a pattern of "dd-MMM-yyyy".
If the field in the database is actually a string rather than a date, you will need to convert the date you read from the file as I explained above. To do that, use an expression in tMap e.g. Talend.formatDate("MM-dd-yyyy hh:mm:ss",row1.myDate).