Change a string to Date format

Six 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/

Cloud Free Trial

Try Talend Cloud free for 30 days.

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.