Combine Columns Date and Hours

Highlighted
Five Stars

Combine Columns Date and Hours

Hi friends, good morning! I would like to know how do I combine two columns, one of date and another of houras in the talend and import into the database the date format time?

 

Ex: Column DataRef: 11/02/2019 and column hour string: 10:22:03, I would like to save the following column in the db 11/02/2019 10:22:03 ?

 

Thanks !

Eleven Stars

Re: Combine Columns Date and Hours

hi, the best way for me it's to format date and time to string. concatenate them then retrive datetime from this string.

if columns came from db you can do it on db side

an other way is to merge date and time in sql using tDbRow and an insert query.

good luck

Francois Denis

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

Community Manager

Re: Combine Columns Date and Hours

This very much depends upon the column types you are combining and the column type you want to output. If they are Strings and you want to output in a String column, you simply need to concatenate using something like this....

 

row.DateColumn +" " +row.TimeColumn

....in your output column in a tMap.

 

Otherwise, it might take a little more than that, but it still won't be too difficult.

Community Manager

Re: Combine Columns Date and Hours

Sorry for jumping in @fdenis. I started responding before you posted and left the response window while I had a call. Seems like you can handle this one :-)

Eleven Stars

Re: Combine Columns Date and Hours

@rhall_2_0 no problems. Smiley Happy

Francois Denis

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

Five Stars

Re: Combine Columns Date and Hours

Hi You can use tJavaRow components and use below logic

 

output_row.Date = input_row.Date; // it is string datatype
output_row.Hours = input_row.Hours; // it is string datatype
output_row.Date_hours = TalendDate.parseDate("dd/MM/yyyy HH:mm:ss",input_row.Date+" "+input_row.Hours);

 

and in output oracle use timestamp datatype of your required date .

 

Thanks,

Dhanraj

 

 

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.