Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 !

Labels (4)
5 Replies
fdenis
Master
Master

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
Anonymous
Not applicable
Author

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.

Anonymous
Not applicable
Author

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 🙂

fdenis
Master
Master

@rhall no problems. 0683p000009MACn.png
Anonymous
Not applicable
Author

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

 

 


Date.PNG