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

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