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
Highlighted
Fifteen Stars TRF
Fifteen 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
Highlighted
Fifteen Stars TRF
Fifteen 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.

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog