Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
talendtester
Creator III
Creator III

How to filter based on date time?

I am reading from a delimited file and trying to filter for only the rows of date within a specific date time range.
I found this for dates:
https://help.talend.com/search/all?query=How+to+compare+Dates&content-lang=en
How can I make it compare Date Times?
I am trying this:
context.myStartDate ="2017-02-03 23:00:00"
context.myEndDate   ="2017-02-04 00:00:00"

     TalendDate.compareDate( input_row.newColumn5, context.myStartDate,"yyyy-MM-dd HH:mm:ss") > 0
&& TalendDate.compareDate( input_row.newColumn5, context.myEndDate,  "yyyy-MM-dd HH:mm:ss") < 1

Is it possible with a job that looks like this?
tFileInputDelimited > tFilterRow > tFileOutputDelimited
Labels (2)
12 Replies
vapukov
Master II
Master II

ok, thanks!

welcome! 😉
this is why I ask - what is the problem?
why it not work in Your case? (I of course sure - You was tested it and not just ask how to do something 🙂 )
there are many reasons for wrong work of some real Job
sbxr
Contributor III
Contributor III

How can we filter files based on Date from a directory and print those filename.

for example i want to copy all the file to other folder which is 6 months old.

Anonymous
Not applicable

@sbxr , use a tFileList to iterate each file in the directory, and then use a tFileProperties to read the file properties including mtime, filename etc, check the mtime to determine if it is needed to move.