InTimeRange

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

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 time range with day precision

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

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1451606400000false
java.lang.Long1483228800000true
java.lang.Long1483232400000true
java.lang.Long1483315199000true
java.lang.Long1485907200000true
java.lang.Long1485907201000false
nullfalse

In time range with second precision

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

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1483234209000false
java.lang.Long1483234210000true
java.lang.Long1483234220000true
java.lang.Long1483234250000true
java.lang.Long1483234251000false
nullfalse

In time range with timestamps

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

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1483315199false
java.lang.Long1483315200true
java.lang.Long1483316200true
java.lang.Long1485907200true
java.lang.Long1485907201false
nullfalse

In time range exclusive

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

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1451606400000false
java.lang.Long1483228800000false
java.lang.Long1483232400000true
java.lang.Long1483315199000true
java.lang.Long1485907200000false
java.lang.Long1485907201000false
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 InTimeRange function = new InTimeRange.Builder()
        .startOffset(-7L)
                // end is not set - it is unbounded
        .offsetUnit(TimeUnit.DAY)
        .build();
{
  "class" : "InTimeRange",
  "startOffset" : -7,
  "offsetUnit" : "DAY"
}
{
  "class" : "uk.gov.gchq.koryphe.impl.predicate.range.InTimeRange",
  "startOffset" : -7,
  "offsetUnit" : "DAY"
}
g.InTimeRange( 
  start_offset=-7, 
  offset_unit="DAY" 
)

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1530442790299false
java.lang.Long1530615590299true
java.lang.Long1531047590299true
java.lang.Long1531133990299true
nullfalse

Exactly 7 hours ago

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

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1531105190392false
java.lang.Long1531108800392true
java.lang.Long1531112380392true
java.lang.Long1531112400392false
java.lang.Long1531133990392false
nullfalse

In date range with time unit microseconds

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

Input type:

java.lang.Long

Example inputs:

Input TypeInputResult
java.lang.Long1483234209000000false
java.lang.Long1483234210000000true
java.lang.Long1483234220000000true
java.lang.Long1483234250000000true
java.lang.Long1483234251000000false
nullfalse

results matching ""

    No results matching ""