time difference

Six Stars

time difference

Hi,
I would like to find time dfference between dbinput and current timestamp. I want the difference in minuts.
My timestamp column in dbinput is date.
I am wondering how I can do it in talend.
Thanks.
Community Manager

Re: time difference

Hi
Using the built-in function, TalendDate.diffDate(Date date1, Date date2, String dateType), it return a long type, for exmaple:
TalendDate.diffDate(row1.mydate, TalendDate.getCurrentDate(),"mm")
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Four Stars

Re: time difference

@shong This doesn't work if we want the difference in minutes i.e. "mm" format.

Community Manager

Re: time difference

@AmrapaliPatil
I just made a simple testing and I can confirm the function TalendDate.diffDate can get the difference in minutes. About your issue, I guess your timestamp data does not contains the time part, can you show an example what the dbinput component read from db?
Can you have a try to change the data type to datetime and test again?

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch