PlainTime
objects can be serialized and parsed using the RFC 9557 format, an extension to the ISO 8601 / RFC 3339 format. The string has the following form:
HH:mm:ss.sssssssss
HH
-
A two-digit number from 00
to 23
. It may be prefixed by the time designator T
or t
.
mm
Optional -
A two-digit number from 00
to 59
. Defaults to 00
.
ss.sssssssss
Optional -
A two-digit number from 00
to 59
. May optionally be followed by a .
or ,
and one to nine digits. Defaults to 00
. The HH
, mm
, and ss
components can be separated by :
or nothing. You can omit either just ss
or both ss
and mm
, so the time can be one of three forms: HH
, HH:mm
, or HH:mm:ss.sssssssss
.
As an input, you may optionally include the date, offset, time zone identifier, and calendar, in the same format as PlainDateTime
, but they will be ignored. A date-only string will be rejected. Other annotations in the [key=value]
format are also ignored, and they must not have the critical flag.
When serializing, you can configure the fractional second digits.