Talend - Date Conversion issues!!!

Seven Stars

Talend - Date Conversion issues!!!

Hello All,

I have comma delimited flat file as my source with row structure as 

cust_number

cust_name

cust_age

cust_gender

cust_height

cust_registered_date

001

Rado

25

M

5.4

01-jan-2015

002

John

65

M

4.9

10-nov-2016

 

my requirement is to convert the cust_registered_date into yyyy/mm/dd format and populate a target flat file after few more derivations on the other fields....i am having issues with converting this cust_registered_date to any other format....read through as many posts as possible on the community and below is all i did, but with no success

1) Tried this conversion using TalendDate.parsedate, formatdate

2) Tried putting my input column data type to String, Date, similarly tried changing  variable port data type to string, date 

3) Tried using the formats yyyy-MMM-dd, yyyy-mmm-dd,yyyy-mon-dd 

4) Tried putting single quotes, double quotes, without quotes to the incoming values in the src file

 

My requirement if put in Sql would be a one liner:

to_date(cust_registered_date,'yyyy-mon-dd')

 

can any please help

 

Moderator

Re: Talend - Date Conversion issues!!!

Hello,

What's your input source data type? String or Date?If you need parse String to Date:

The expression should be :TalendDate.parseDate("dd-MM-yyyy",cust_registered_date).

date.png

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Twelve Stars

Re: Talend - Date Conversion issues!!!

I'had got the same trouble. I solved it by splitting date into tmap and recreate it from number(if 'jan' then 01)

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Seven Stars

Re: Talend - Date Conversion issues!!!

Hi fdenis,

 

Can you elaborate your approach with screen shots please

Seven Stars

Re: Talend - Date Conversion issues!!!

Thanks Sabrina.

I think the format differences you highlighted in the expression editor and the schema date pattern are not typos but intentional...if Yes, then this is something interesting that i have to check. Will Let you know if that works

Forteen Stars

Re: Talend - Date Conversion issues!!!

@tnewbie , just replace the below expression in  @xdshi  screenshot.

 

TalendDate.parseDate("dd-MMM-yyyy",row1.date)


yyyy/mm/dd

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog