datetimeSerializationMode

Controls the JSON output format for DATETIME values during serialization.

Syntax

The value parameter is an INTEGER:

  • 0: Genero default format (default)
  • 1: RFC 3339, normalized to UTC
  • 2: RFC 3339, with the local time zone offset

A value outside the allowed range raises error -15824.

datetimeSerializationMode is an optional option.

Usage

Use this option to control how DATETIME values are written to JSON. By default (value 0), the serializer writes DATETIME values in the Genero native format. Set to 1 to write in RFC 3339 format normalized to UTC, or to 2 to write in RFC 3339 format with the local time zone offset of the server process.

When set to 2, the offset reflects the time zone of the server process at runtime. The same DATETIME value can produce different output on servers configured with different time zones.

For a description of the Genero native and RFC 3339 formats, see BDL to JSON type conversion rules.

Note: This option does not apply to util.JSON. For equivalent behavior, use util.JSON.setDatetimeSerializationMode.

Affects

Serialization (BDL to JSON)

Example

To write DATETIME values in RFC 3339 format normalized to UTC:

CALL json.Serializer.setOption("datetimeSerializationMode", 1)

For a complete example, see Serializing DATETIME and INTERVAL values in standard formats.