Compare file last modified date with system date

I'm reading in files and want to filter out any less that two minutes old. ie I only want to read in files whose modified date is at least 120 seconds earlier than the system date. I can get mdate and mtime_string from tFile_Properties but one is long and the other string. How can I compare either of these with the system date, which is a date?
I'm starting with FileList as I will be iterating through whichever files have just arrived in a directory.
I've taken a look at TalendDate.parseDate but can't work it out.
Thanks,
Jackie
1 REPLY
Seventeen Stars

Re: Compare file last modified date with system date

Timestamps in Java are internal long value (milliseconds starting from 01.01.1970).
The long value provided of the tFileProperties is such kind of long value.
You can get the long value also from any Java Date object.
The routine TalendDate.getCurrentDate() returns the current timestamp and
TalendDate.getCurrentDate().getTime() returns the mentioned long value from now.
I would translate the iteration into a flow with tIterateToFlow component, send this flow in a filter component with following filter expression:
input_flow.mtime < (TalendDate.getCurrentDate().getTime() - (120 * 1000))