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 TypeInputResult TypeResult
java.util.DateTue Jan 06 18:39:25 UTC 1970java.lang.String1970-01-06 18:39:25.200
java.util.DateThu Jan 01 00:00:00 UTC 1970java.lang.String1970-01-01 00:00:00.000
java.lang.Long1665484771788ClassCastException: java.lang.Long cannot be cast to java.util.Date
java.util.DateFri Dec 26 05:20:34 UTC 1969java.lang.String1969-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 TypeInputResult TypeResult
java.util.DateTue Jan 06 18:39:25 UTC 1970java.lang.String70-01-06 18:39
java.util.DateThu Jan 01 00:00:00 UTC 1970java.lang.String70-01-01 00:00
java.lang.Long1665484771834ClassCastException: java.lang.Long cannot be cast to java.util.Date
java.util.DateFri Dec 26 05:20:34 UTC 1969java.lang.String69-12-26 05:20
nullnull

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 TypeInputResult TypeResult
java.util.DateTue Jan 06 18:39:25 UTC 1970java.lang.String70-01-06
java.util.DateThu Jan 01 00:00:00 UTC 1970java.lang.String70-01-01
java.lang.Long1665484771880ClassCastException: java.lang.Long cannot be cast to java.util.Date
java.util.DateFri Dec 26 05:20:34 UTC 1969java.lang.String69-12-26
nullnull

results matching ""

    No results matching ""