ToDateString
See javadoc - uk.gov.gchq.koryphe.impl.function.ToDateString
Available since Koryphe version 1.8.0
Converts a date to a string
Examples
To date string micro formatted
Java
JSON
Full JSON
Python
final ToDateString function = new ToDateString("yyyy-MM-dd HH:mm:ss.SSS");
{
"class" : "ToDateString",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ToDateString",
"format" : "yyyy-MM-dd HH:mm:ss.SSS"
}
g.ToDateString(
format="yyyy-MM-dd HH:mm:ss.SSS"
)
Input type:
java.util.Date
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.Date | Tue Jan 06 18:39:25 UTC 1970 | java.lang.String | 1970-01-06 18:39:25.200 |
java.util.Date | Thu Jan 01 00:00:00 UTC 1970 | java.lang.String | 1970-01-01 00:00:00.000 |
java.lang.Long | 1665484771788 | ClassCastException: java.lang.Long cannot be cast to java.util.Date | |
java.util.Date | Fri Dec 26 05:20:34 UTC 1969 | java.lang.String | 1969-12-26 05:20:34.800 |
To date string short formatted to min
Java
JSON
Full JSON
Python
final ToDateString function = new ToDateString("yy-MM-dd HH:mm");
{
"class" : "ToDateString",
"format" : "yy-MM-dd HH:mm"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ToDateString",
"format" : "yy-MM-dd HH:mm"
}
g.ToDateString(
format="yy-MM-dd HH:mm"
)
Input type:
java.util.Date
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.Date | Tue Jan 06 18:39:25 UTC 1970 | java.lang.String | 70-01-06 18:39 |
java.util.Date | Thu Jan 01 00:00:00 UTC 1970 | java.lang.String | 70-01-01 00:00 |
java.lang.Long | 1665484771834 | ClassCastException: java.lang.Long cannot be cast to java.util.Date | |
java.util.Date | Fri Dec 26 05:20:34 UTC 1969 | java.lang.String | 69-12-26 05:20 |
null | null |
To date string short formatted to day
Java
JSON
Full JSON
Python
final ToDateString function = new ToDateString("yy-MM-dd");
{
"class" : "ToDateString",
"format" : "yy-MM-dd"
}
{
"class" : "uk.gov.gchq.koryphe.impl.function.ToDateString",
"format" : "yy-MM-dd"
}
g.ToDateString(
format="yy-MM-dd"
)
Input type:
java.util.Date
Example inputs:
Input Type | Input | Result Type | Result |
---|---|---|---|
java.util.Date | Tue Jan 06 18:39:25 UTC 1970 | java.lang.String | 70-01-06 |
java.util.Date | Thu Jan 01 00:00:00 UTC 1970 | java.lang.String | 70-01-01 |
java.lang.Long | 1665484771880 | ClassCastException: java.lang.Long cannot be cast to java.util.Date | |
java.util.Date | Fri Dec 26 05:20:34 UTC 1969 | java.lang.String | 69-12-26 |
null | null |