InDateRange

See javadoc - uk.gov.gchq.koryphe.impl.predicate.range.InDateRange

Available since Koryphe version 1.1.0

You can configure the start and end time strings using the following formats:

  • timestamp in milliseconds
  • yyyy/MM
  • yyyy/MM/dd
  • yyyy/MM/dd HH
  • yyyy/MM/dd HH:mm
  • yyyy/MM/dd HH:mm:ss

You can use a space, '-', '/', '_', ':', '|', or '.' to separate the parts.

Examples

In date range with day precision

Java
JSON
Full JSON
Python
final InDateRange function = new InDateRange.Builder()
        .start("2017/01/01")
        .end("2017/02/01")
        .build();
{
  "class" : "InDateRange",
  "start" : "2017/01/01",
  "end" : "2017/02/01"
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InDateRange",
  "start" : "2017/01/01",
  "end" : "2017/02/01"
}
g.InDateRange( 
  end="2017/02/01", 
  start="2017/01/01" 
)

Input type:

java.util.Date

Example inputs:

Input TypeInputResult
java.util.DateFri Jan 01 00:00:00 UTC 2016false
java.util.DateSun Jan 01 00:00:00 UTC 2017true
java.util.DateSun Jan 01 01:00:00 UTC 2017true
java.util.DateSun Jan 01 23:59:59 UTC 2017true
java.util.DateWed Feb 01 00:00:00 UTC 2017true
java.util.DateWed Feb 01 00:00:01 UTC 2017false
nullfalse

In date range with second precision

Java
JSON
Full JSON
Python
final InDateRange function = new InDateRange.Builder()
        .start("2017/01/01 01:30:10")
        .end("2017/01/01 01:30:50")
        .build();
{
  "class" : "InDateRange",
  "start" : "2017/01/01 01:30:10",
  "end" : "2017/01/01 01:30:50"
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InDateRange",
  "start" : "2017/01/01 01:30:10",
  "end" : "2017/01/01 01:30:50"
}
g.InDateRange( 
  start="2017/01/01 01:30:10", 
  end="2017/01/01 01:30:50" 
)

Input type:

java.util.Date

Example inputs:

Input TypeInputResult
java.util.DateSun Jan 01 01:30:09 UTC 2017false
java.util.DateSun Jan 01 01:30:10 UTC 2017true
java.util.DateSun Jan 01 01:30:20 UTC 2017true
java.util.DateSun Jan 01 01:30:50 UTC 2017true
java.util.DateSun Jan 01 01:30:51 UTC 2017false
nullfalse

In date range with timestamps

Java
JSON
Full JSON
Python
final InDateRange function = new InDateRange.Builder()
        .start("1483315200")
        .end("1485907200")
        .build();
{
  "class" : "InDateRange",
  "start" : "1483315200",
  "end" : "1485907200"
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InDateRange",
  "start" : "1483315200",
  "end" : "1485907200"
}
g.InDateRange( 
  end="1485907200", 
  start="1483315200" 
)

Input type:

java.util.Date

Example inputs:

Input TypeInputResult
java.util.DateSun Jan 18 04:01:55 UTC 1970false
java.util.DateSun Jan 18 04:01:55 UTC 1970true
java.util.DateSun Jan 18 04:01:56 UTC 1970true
java.util.DateSun Jan 18 04:45:07 UTC 1970true
java.util.DateSun Jan 18 04:45:07 UTC 1970false
nullfalse

In date range exclusive

Java
JSON
Full JSON
Python
final InDateRange function = new InDateRange.Builder()
        .start("2017/01/01")
        .end("2017/02/01")
        .startInclusive(false)
        .endInclusive(false)
        .build();
{
  "class" : "InDateRange",
  "start" : "2017/01/01",
  "end" : "2017/02/01",
  "startInclusive" : false,
  "endInclusive" : false
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InDateRange",
  "start" : "2017/01/01",
  "end" : "2017/02/01",
  "startInclusive" : false,
  "endInclusive" : false
}
g.InDateRange( 
  end_inclusive=False, 
  end="2017/02/01", 
  start="2017/01/01", 
  start_inclusive=False 
)

Input type:

java.util.Date

Example inputs:

Input TypeInputResult
java.util.DateFri Jan 01 00:00:00 UTC 2016false
java.util.DateSun Jan 01 00:00:00 UTC 2017false
java.util.DateSun Jan 01 01:00:00 UTC 2017true
java.util.DateSun Jan 01 23:59:59 UTC 2017true
java.util.DateWed Feb 01 00:00:00 UTC 2017false
java.util.DateWed Feb 01 00:00:01 UTC 2017false
nullfalse

Within the last week

If the end of the range is not specified then the end of the range is unbounded.

Java
JSON
Full JSON
Python
final InDateRange function = new InDateRange.Builder()
        .startOffset(-7L)
                // end is not set - it is unbounded
        .offsetUnit(TimeUnit.DAY)
        .build();
{
  "class" : "InDateRange",
  "startOffset" : -7,
  "offsetUnit" : "DAY"
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InDateRange",
  "startOffset" : -7,
  "offsetUnit" : "DAY"
}
g.InDateRange( 
  offset_unit="DAY", 
  start_offset=-7 
)

Input type:

java.util.Date

Example inputs:

Input TypeInputResult
java.util.DateSun Jul 01 10:59:47 UTC 2018false
java.util.DateTue Jul 03 10:59:47 UTC 2018true
java.util.DateSun Jul 08 10:59:47 UTC 2018true
java.util.DateMon Jul 09 10:59:47 UTC 2018true
nullfalse

Exactly 7 hours ago

Java
JSON
Full JSON
Python
final InDateRange function = new InDateRange.Builder()
        .startOffset(-7L)
        .endOffset(-6L)
        .endInclusive(false)
        .offsetUnit(TimeUnit.HOUR)
        .build();
{
  "class" : "InDateRange",
  "startOffset" : -7,
  "endOffset" : -6,
  "endInclusive" : false,
  "offsetUnit" : "HOUR"
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InDateRange",
  "startOffset" : -7,
  "endOffset" : -6,
  "endInclusive" : false,
  "offsetUnit" : "HOUR"
}
g.InDateRange( 
  end_inclusive=False, 
  end_offset=-6, 
  start_offset=-7, 
  offset_unit="HOUR" 
)

Input type:

java.util.Date

Example inputs:

Input TypeInputResult
java.util.DateMon Jul 09 02:59:47 UTC 2018false
java.util.DateMon Jul 09 03:59:57 UTC 2018true
java.util.DateMon Jul 09 04:59:37 UTC 2018true
java.util.DateMon Jul 09 04:59:57 UTC 2018false
java.util.DateMon Jul 09 10:59:47 UTC 2018false
nullfalse

results matching ""

    No results matching ""