Change a string to Date format

Seven Stars

Change a string to Date format

Hi ,

 

I have a Data which has a column Transaction date which is in string how can I change it to Date type and in the below output format.

Input format --MM/dd/yyyy hh:mm

Transaction_Date

1/2/2009 6:17 AM
1/2/2009 4:53 AM

 

Output:format -- dd-MM-yyyy HH:mm

Transaction_Date

2-01-2009 6:17 AM
2-01-2009 4:53 AM

 

Thanks


Accepted Solutions
Four Stars

Re: Change a string to Date format

Thank you for answer! I had the same issue!

 

My best wishes: https://diceus.com/offshore-software-development-benefits/


All Replies
Highlighted
Eight Stars

Re: Change a string to Date format

Hi sbxr,

 

Here is the expression to parse the string which you have mentioned.

 

TalendDate.parseDate("dd/MM/yyyy hh:mm aa",row1.Transaction_Date)

 

DateParsing.jpg

 

Four Stars

Re: Change a string to Date format

Thank you for answer! I had the same issue!

 

My best wishes: https://diceus.com/offshore-software-development-benefits/

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

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

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

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch