How to filter based on date time?

Nine Stars

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

Accepted Solutions
Twelve Stars

Re: How to filter based on date time?

please
  
same with tFilterRow
  
-----------

All Replies
Nine Stars

Re: How to filter based on date time?

Can anyone answer?
Twelve Stars

Re: How to filter based on date time?

Can anyone answer?

What is Your problem?
Yes You can use tFilterRow or tMap with filter conditions
for examples TalendDate.diffDate or TalendDate.compareDate
-----------
Nine Stars

Re: How to filter based on date time?

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
Twelve Stars

Re: How to filter based on date time?

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
-----------
Nine Stars

Re: How to filter based on date time?

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
Twelve Stars

Re: How to filter based on date time?

please
  
same with tFilterRow
  
-----------
Nine Stars

Re: How to filter based on date time?

So use a tMap instead of a tFilterRow?
Twelve Stars

Re: How to filter based on date time?

So use a tMap instead of a tFilterRow?

any
-----------
Nine Stars

Re: How to filter based on date time?

ok, thanks!
Twelve Stars

Re: How to filter based on date time?

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
-----------