how to convert 21-Feb-18 08:34:28 to 02/21/2018 08:34:28 AM

Six Stars

how to convert 21-Feb-18 08:34:28 to 02/21/2018 08:34:28 AM

A excel source file has date format like 21-Feb-18 08:34:28. 

How can I format it to  02/21/2018 08:34:28 AM in Talend? Thank you.


Accepted Solutions
Forteen Stars TRF
Forteen Stars

Re: how to convert 21-Feb-18 08:34:28 to 02/21/2018 08:34:28 AM

Hi,
Try the following:
TalendDate.formatDate("MM/dd/yyyy HH:mm:ss", TalendDate.parseDateLocale("dd-MMM-yyyy HH:mm:ss", "21-Feb-18 08:34:28","EN") )
Have to replace the constant date by the row.field you want to convert.
Hope this help (not tried because on my mobile).

TRF

All Replies
Forteen Stars TRF
Forteen Stars

Re: how to convert 21-Feb-18 08:34:28 to 02/21/2018 08:34:28 AM

Hi,
Try the following:
TalendDate.formatDate("MM/dd/yyyy HH:mm:ss", TalendDate.parseDateLocale("dd-MMM-yyyy HH:mm:ss", "21-Feb-18 08:34:28","EN") )
Have to replace the constant date by the row.field you want to convert.
Hope this help (not tried because on my mobile).

TRF
Six Stars

Re: how to convert 21-Feb-18 08:34:28 to 02/21/2018 08:34:28 AM

Hi TRF: It works. Thank you very much.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.