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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
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)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

please
0683p000009MDG8.png  0683p000009MDDA.png  0683p000009MD5b.png
same with tFilterRow
0683p000009MD2N.png   0683p000009MDGD.png

View solution in original post

12 Replies
talendtester
Creator III
Creator III
Author

Can anyone answer?
vapukov
Master II
Master II

Can anyone answer?

What is Your problem?
Yes You can use tFilterRow or tMap with filter conditions
for examples  TalendDate.diffDate or  TalendDate.compareDate
talendtester
Creator III
Creator III
Author

I have been trying to filter the date time for a specific hour on a particular day with tFilterRow but can't get it to work. So far I have only been able to filter for the particular day. I am having trouble filtering the hour.
Can you please share an example of how to filter for an hour like 5pm? (5pm GMT is 23:00 Central Standard Time)
Thanks
vapukov
Master II
Master II

I have been trying to filter the date time for a specific hour on a particular day with tFilterRow but can't get it to work. So far I have only been able to filter for the particular day. I am having trouble filtering the hour.
Can you please share an example of how to filter for an hour like 5pm? (5pm GMT is 23:00 Central Standard Time)
Thanks

Sure
You always must convert data to same format, so if You need example - please attach sample data set
talendtester
Creator III
Creator III
Author

myDate
2017-02-03 23:30:57
2017-02-03 23:13:49
2017-02-03 23:30:19
2017-02-03 23:27:34
2017-02-03 23:19:40
2017-02-03 23:46:29
2017-02-03 23:06:06
2017-02-03 23:48:32
2017-02-03 23:52:16
2017-02-03 23:50:44
2017-02-03 23:52:16
2017-02-03 23:43:30
2017-02-03 23:43:22
2017-02-03 23:42:01
2017-02-03 23:03:19
2017-02-03 22:31:42
2017-02-03 22:27:38
2017-02-03 22:52:26
2017-02-03 22:35:15
2017-02-03 22:45:49
2017-02-03 22:16:10
2017-02-03 22:05:28
2017-02-03 22:00:28
2017-02-03 22:44:11
2017-02-03 22:07:05
2017-02-03 22:39:52
2017-02-03 22:35:17
2017-02-03 22:38:33
2017-02-03 22:53:15
2017-02-03 22:37:19
2017-02-03 22:37:48
2017-02-03 22:42:46
2017-02-03 22:20:02
2017-02-03 22:37:45
2017-02-03 22:38:18
2017-02-03 22:38:55
2017-02-03 22:52:02
2017-02-03 22:08:29
2017-02-03 22:06:54
2017-02-03 22:17:52
2017-02-03 22:43:04
2017-02-03 22:37:56
2017-02-03 22:15:54
2017-02-03 22:11:29
2017-02-03 22:11:56
2017-02-03 22:48:49
2017-02-03 22:08:48
2017-02-03 22:40:58
vapukov
Master II
Master II

please
0683p000009MDG8.png  0683p000009MDDA.png  0683p000009MD5b.png
same with tFilterRow
0683p000009MD2N.png   0683p000009MDGD.png
talendtester
Creator III
Creator III
Author

So use a tMap instead of a tFilterRow?
vapukov
Master II
Master II

So use a tMap instead of a tFilterRow?

any
talendtester
Creator III
Creator III
Author

ok, thanks!