Patterns for OffsetDateTime values

The OffsetDateTime type supports the following patterns:

Standard Patterns

  • G: General invariant ISO-8601 pattern, down to the second. This corresponds to the custom pattern yyyy'-'MM'-'dd'T'HH':'mm':'sso<G>.
  • o: Extended invariant ISO-8601 pattern, down to the tick. This will round-trip values except for the calendar system. This corresponds to the custom pattern yyyy'-'MM'-'dd'T'HH':'mm':'ss;FFFFFFFo<G>.
  • r: Full round-trip pattern including calendar system. This corresponds to the custom pattern yyyy'-'MM'-'dd'T'HH':'mm':'ss;FFFFFFFo<G> '('c')'.

Custom Patterns

The custom format patterns for the local date and time parts of the value are the same as the custom patterns for LocalDateTime. There is an additional specifier for the offset.

The "o" specifier must always be followed by a pattern for Offset within angle brackets. The pattern may be a standard pattern or a custom pattern. For example, a pattern of "yyyy-MM-dd HH:mm:ss o<G>" might produce output of "2013-07-17 06:20:35 Z" or "2013-07-17 07:20:35 +01:00".