Combine Columns Date and Hours

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 !

Twelve 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!

Highlighted
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 :-)

Twelve 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

 

 

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

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog