GLib.DateTime.format_iso8601

### Method

# GLib DateTimeformat_iso8601

since: 2.62

#### Declaration

    gchar*
    g_date_time_format_iso8601 (
      GDateTime* datetime
    )

#### Description

Format `datetime` in ISO 8601 format, including the date, time and time zone, and return that as a UTF-8 encoded string.

Since GLib 2.66, this will output to sub-second precision if needed.

Available since: 2.62

#### Return value

Type: `gchar*`

A newly allocated string formatted in ISO 8601 format or `NULL` in the case that there was an error. The string should be freed with g_free().

The caller of the method takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.
The value is a NUL terminated UTF-8 string.