ParseTime
See javadoc - uk.gov.gchq.koryphe.impl.function.ParseTime
Available since Koryphe version 1.8.0
Parses a date string into a timestamp
Examples
Parse time
Java
JSON
Full JSON
Python
final ParseTime parseTime = new ParseTime();
{
"class" : "ParseTime",
"timeUnit" : "MILLISECOND"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ParseTime",
"timeUnit" : "MILLISECOND"
}
g.ParseTime(
time_unit="MILLISECOND"
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.String | 2015-10-21 16:29:00.000 | java.lang.Long | 1445444940000 |
java.lang.String | 1985-10-26 09:00:00.000 | java.lang.Long | 499165200000 |
java.lang.String | 1885-01-01 12:00:00.000 | java.lang.Long | -2682244800000 |
Parse formatted time
Java
JSON
Full JSON
Python
final ParseTime parseTime = new ParseTime().format("yyyy-MM hh:mm");
{
"class" : "ParseTime",
"format" : "yyyy-MM hh:mm",
"timeUnit" : "MILLISECOND"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ParseTime",
"format" : "yyyy-MM hh:mm",
"timeUnit" : "MILLISECOND"
}
g.ParseTime(
format="yyyy-MM hh:mm",
time_unit="MILLISECOND"
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.String | 2015-10 16:29 | java.lang.Long | 1443716940000 |
java.lang.String | 1985-10 09:00 | java.lang.Long | 497005200000 |
java.lang.String | 1885-01 12:00 | java.lang.Long | -2682288000000 |
java.lang.String | 2015-10-21 16:29 | IllegalArgumentException: Date string could not be parsed: 2015-10-21 16:29 |
Parse formatted greenwich mean time
Java
JSON
Full JSON
Python
final ParseTime parseTime = new ParseTime()
.format("yyyy-MM-dd")
.timeUnit("SECOND")
.timeZone("GMT");
{
"class" : "ParseTime",
"format" : "yyyy-MM-dd",
"timeZone" : "GMT",
"timeUnit" : "SECOND"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ParseTime",
"format" : "yyyy-MM-dd",
"timeZone" : "GMT",
"timeUnit" : "SECOND"
}
g.ParseTime(
time_zone="GMT",
format="yyyy-MM-dd",
time_unit="SECOND"
)
Input type:
java.lang.String
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.lang.String | 2015-10-21 16:29:00.000 | java.lang.Long | 1445385600 |
java.lang.String | 1985-10-26 09:00:00.000 | java.lang.Long | 499132800 |
java.lang.String | 1885-01-01 12:00:00.000 | java.lang.Long | -2682288000 |