DateTime.formatIso8601

string formatIso8601()

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.

Returns

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 [glib.global.gfree].