<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="glib-GDateTime">
<refmeta>
<refentrytitle role="top_of_page" id="glib-GDateTime.top_of_page">GDateTime</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GDateTime</refname>
<refpurpose>a structure representing Date and Time</refpurpose>
</refnamediv>

<refsect1 id="glib-GDateTime.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-unref">g_date_time_unref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-ref">g_date_time_ref</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-now">g_date_time_new_now</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-now-local">g_date_time_new_now_local</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-now-utc">g_date_time_new_now_utc</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-from-unix-local">g_date_time_new_from_unix_local</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-from-unix-utc">g_date_time_new_from_unix_utc</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-from-timeval-utc">g_date_time_new_from_timeval_utc</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-from-iso8601">g_date_time_new_from_iso8601</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new">g_date_time_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-local">g_date_time_new_local</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-new-utc">g_date_time_new_utc</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add">g_date_time_add</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-years">g_date_time_add_years</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-months">g_date_time_add_months</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-weeks">g_date_time_add_weeks</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-days">g_date_time_add_days</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-hours">g_date_time_add_hours</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-minutes">g_date_time_add_minutes</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-seconds">g_date_time_add_seconds</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-add-full">g_date_time_add_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-compare">g_date_time_compare</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GTimeSpan"><returnvalue>GTimeSpan</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-difference">g_date_time_difference</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-hash">g_date_time_hash</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-equal">g_date_time_equal</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-ymd">g_date_time_get_ymd</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-year">g_date_time_get_year</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-month">g_date_time_get_month</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-day-of-month">g_date_time_get_day_of_month</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-week-numbering-year">g_date_time_get_week_numbering_year</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-week-of-year">g_date_time_get_week_of_year</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-day-of-week">g_date_time_get_day_of_week</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-day-of-year">g_date_time_get_day_of_year</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-hour">g_date_time_get_hour</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-minute">g_date_time_get_minute</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-second">g_date_time_get_second</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-microsecond">g_date_time_get_microsecond</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gdouble"><returnvalue>gdouble</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-seconds">g_date_time_get_seconds</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gint64"><returnvalue>gint64</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-to-unix">g_date_time_to_unix</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GTimeSpan"><returnvalue>GTimeSpan</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-get-utc-offset">g_date_time_get_utc_offset</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GTimeZone"><returnvalue>GTimeZone</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-get-timezone">g_date_time_get_timezone</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-get-timezone-abbreviation">g_date_time_get_timezone_abbreviation</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-date-time-is-daylight-savings">g_date_time_is_daylight_savings</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-to-timezone">g_date_time_to_timezone</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-to-local">g_date_time_to_local</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-to-utc">g_date_time_to_utc</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-format">g_date_time_format</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-date-time-format-iso8601">g_date_time_format_iso8601</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-GDateTime.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="typedef_keyword">typedef</entry><entry role="function_name"><link linkend="GTimeSpan">GTimeSpan</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TIME-SPAN-DAY:CAPS">G_TIME_SPAN_DAY</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TIME-SPAN-HOUR:CAPS">G_TIME_SPAN_HOUR</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TIME-SPAN-MINUTE:CAPS">G_TIME_SPAN_MINUTE</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TIME-SPAN-SECOND:CAPS">G_TIME_SPAN_SECOND</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-TIME-SPAN-MILLISECOND:CAPS">G_TIME_SPAN_MILLISECOND</link></entry></row>

<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GDateTime">GDateTime</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-GDateTime.includes"><title>Includes</title><synopsis>#include &lt;glib.h&gt;
#include &lt;glib/gprintf.h&gt;
</synopsis></refsect1>

<refsect1 id="glib-GDateTime.description" role="desc">
<title role="desc.title">Description</title>
<para><link linkend="GDateTime"><type>GDateTime</type></link> is a structure that combines a Gregorian date and time
into a single structure.  It provides many conversion and methods to
manipulate dates and times.  Time precision is provided down to
microseconds and the time can range (proleptically) from 0001-01-01
00:00:00 to 9999-12-31 23:59:59.999999.  <link linkend="GDateTime"><type>GDateTime</type></link> follows POSIX
time in the sense that it is oblivious to leap seconds.</para>
<para><link linkend="GDateTime"><type>GDateTime</type></link> is an immutable object; once it has been created it cannot
be modified further.  All modifiers will create a new <link linkend="GDateTime"><type>GDateTime</type></link>.
Nearly all such functions can fail due to the date or time going out
of range, in which case <link linkend="NULL:CAPS"><literal>NULL</literal></link> will be returned.</para>
<para><link linkend="GDateTime"><type>GDateTime</type></link> is reference counted: the reference count is increased by calling
<link linkend="g-date-time-ref"><function>g_date_time_ref()</function></link> and decreased by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>. When the
reference count drops to 0, the resources allocated by the <link linkend="GDateTime"><type>GDateTime</type></link>
structure are released.</para>
<para>Many parts of the API may produce non-obvious results.  As an
example, adding two months to January 31st will yield March 31st
whereas adding one month and then one month again will yield either
March 28th or March 29th.  Also note that adding 24 hours is not
always the same as adding one day (since days containing daylight
savings time transitions are either 23 or 25 hours in length).</para>
<para><link linkend="GDateTime"><type>GDateTime</type></link> is available since GLib 2.26.</para>

</refsect1>
<refsect1 id="glib-GDateTime.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-date-time-unref" role="function" condition="since:2.26">
<title>g_date_time_unref&#160;()</title>
<indexterm zone="g-date-time-unref" role="2.26"><primary sortas="date_time_unref">g_date_time_unref</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_date_time_unref (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Atomically decrements the reference count of <parameter>datetime</parameter>
 by one.</para>
<para>When the reference count reaches zero, the resources allocated by
<parameter>datetime</parameter>
 are freed</para>
<refsect3 id="g-date-time-unref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-ref" role="function" condition="since:2.26">
<title>g_date_time_ref&#160;()</title>
<indexterm zone="g-date-time-ref" role="2.26"><primary sortas="date_time_ref">g_date_time_ref</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_ref (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Atomically increments the reference count of <parameter>datetime</parameter>
 by one.</para>
<refsect3 id="g-date-time-ref.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-ref.returns" role="returns">
<title>Returns</title>
<para> the <link linkend="GDateTime"><type>GDateTime</type></link> with the reference count increased</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-now" role="function" condition="since:2.26">
<title>g_date_time_new_now&#160;()</title>
<indexterm zone="g-date-time-new-now" role="2.26"><primary sortas="date_time_new_now">g_date_time_new_now</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_now (<parameter><link linkend="GTimeZone"><type>GTimeZone</type></link> *tz</parameter>);</programlisting>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to this exact instant in the given
time zone <parameter>tz</parameter>
.  The time is as accurate as the system allows, to a
maximum accuracy of 1 microsecond.</para>
<para>This function will always succeed unless the system clock is set to
truly insane values (or unless GLib is still being used after the
year 9999).</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-new-now.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tz</para></entry>
<entry role="parameter_description"><para>a <link linkend="GTimeZone"><type>GTimeZone</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-now.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-now-local" role="function" condition="since:2.26">
<title>g_date_time_new_now_local&#160;()</title>
<indexterm zone="g-date-time-new-now-local" role="2.26"><primary sortas="date_time_new_now_local">g_date_time_new_now_local</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_now_local (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to this exact instant in the local
time zone.</para>
<para>This is equivalent to calling <link linkend="g-date-time-new-now"><function>g_date_time_new_now()</function></link> with the time
zone returned by <link linkend="g-time-zone-new-local"><function>g_time_zone_new_local()</function></link>.</para>
<refsect3 id="g-date-time-new-now-local.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-now-utc" role="function" condition="since:2.26">
<title>g_date_time_new_now_utc&#160;()</title>
<indexterm zone="g-date-time-new-now-utc" role="2.26"><primary sortas="date_time_new_now_utc">g_date_time_new_now_utc</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_now_utc (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to this exact instant in UTC.</para>
<para>This is equivalent to calling <link linkend="g-date-time-new-now"><function>g_date_time_new_now()</function></link> with the time
zone returned by <link linkend="g-time-zone-new-utc"><function>g_time_zone_new_utc()</function></link>.</para>
<refsect3 id="g-date-time-new-now-utc.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-from-unix-local" role="function" condition="since:2.26">
<title>g_date_time_new_from_unix_local&#160;()</title>
<indexterm zone="g-date-time-new-from-unix-local" role="2.26"><primary sortas="date_time_new_from_unix_local">g_date_time_new_from_unix_local</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_from_unix_local (<parameter><link linkend="gint64"><type>gint64</type></link> t</parameter>);</programlisting>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given Unix time <parameter>t</parameter>
 in the
local time zone.</para>
<para>Unix time is the number of seconds that have elapsed since 1970-01-01
00:00:00 UTC, regardless of the local time offset.</para>
<para>This call can fail (returning <link linkend="NULL:CAPS"><literal>NULL</literal></link>) if <parameter>t</parameter>
 represents a time outside
of the supported range of <link linkend="GDateTime"><type>GDateTime</type></link>.</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-new-from-unix-local.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>t</para></entry>
<entry role="parameter_description"><para>the Unix time</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-from-unix-local.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-from-unix-utc" role="function" condition="since:2.26">
<title>g_date_time_new_from_unix_utc&#160;()</title>
<indexterm zone="g-date-time-new-from-unix-utc" role="2.26"><primary sortas="date_time_new_from_unix_utc">g_date_time_new_from_unix_utc</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_from_unix_utc (<parameter><link linkend="gint64"><type>gint64</type></link> t</parameter>);</programlisting>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given Unix time <parameter>t</parameter>
 in UTC.</para>
<para>Unix time is the number of seconds that have elapsed since 1970-01-01
00:00:00 UTC.</para>
<para>This call can fail (returning <link linkend="NULL:CAPS"><literal>NULL</literal></link>) if <parameter>t</parameter>
 represents a time outside
of the supported range of <link linkend="GDateTime"><type>GDateTime</type></link>.</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-new-from-unix-utc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>t</para></entry>
<entry role="parameter_description"><para>the Unix time</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-from-unix-utc.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-from-timeval-utc" role="function" condition="deprecated|since:2.26">
<title>g_date_time_new_from_timeval_utc&#160;()</title>
<indexterm zone="g-date-time-new-from-timeval-utc" role="deprecated"><primary sortas="date_time_new_from_timeval_utc">g_date_time_new_from_timeval_utc</primary></indexterm><indexterm zone="g-date-time-new-from-timeval-utc" role="2.26"><primary sortas="date_time_new_from_timeval_utc">g_date_time_new_from_timeval_utc</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_from_timeval_utc (<parameter>const <link linkend="GTimeVal"><type>GTimeVal</type></link> *tv</parameter>);</programlisting>
<warning><para><literal>g_date_time_new_from_timeval_utc</literal> has been deprecated since version 2.62 and should not be used in newly-written code.</para> <para><link linkend="GTimeVal"><type>GTimeVal</type></link> is not year-2038-safe. Use
   <link linkend="g-date-time-new-from-unix-utc"><function>g_date_time_new_from_unix_utc()</function></link> instead.</para>
</warning>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given <link linkend="GTimeVal"><type>GTimeVal</type></link> <parameter>tv</parameter>
 in UTC.</para>
<para>The time contained in a <link linkend="GTimeVal"><type>GTimeVal</type></link> is always stored in the form of
seconds elapsed since 1970-01-01 00:00:00 UTC.</para>
<para>This call can fail (returning <link linkend="NULL:CAPS"><literal>NULL</literal></link>) if <parameter>tv</parameter>
 represents a time outside
of the supported range of <link linkend="GDateTime"><type>GDateTime</type></link>.</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-new-from-timeval-utc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tv</para></entry>
<entry role="parameter_description"><para>a <link linkend="GTimeVal"><type>GTimeVal</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-from-timeval-utc.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-from-iso8601" role="function" condition="since:2.56">
<title>g_date_time_new_from_iso8601&#160;()</title>
<indexterm zone="g-date-time-new-from-iso8601" role="2.56"><primary sortas="date_time_new_from_iso8601">g_date_time_new_from_iso8601</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_from_iso8601 (<parameter>const <link linkend="gchar"><type>gchar</type></link> *text</parameter>,
                              <parameter><link linkend="GTimeZone"><type>GTimeZone</type></link> *default_tz</parameter>);</programlisting>
<para>Creates a <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given
<ulink url="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601 formatted string</ulink>
<parameter>text</parameter>
. ISO 8601 strings of the form &lt;date>&lt;sep>&lt;time>&lt;tz> are supported.</para>
<para>Note that as <link linkend="GDateTime"><type>GDateTime</type></link> "is oblivious to leap seconds", leap seconds information
in an ISO-8601 string will be ignored, so a <literal>23:59:60</literal> time would be parsed as
<literal>23:59:59</literal>.</para>
<para>&lt;sep> is the separator and can be either 'T', 't' or ' '.</para>
<para>&lt;date> is in the form:</para>
<itemizedlist>
<listitem><para><literal>YYYY-MM-DD</literal> - Year/month/day, e.g. 2016-08-24.</para></listitem>
<listitem><para><literal>YYYYMMDD</literal> - Same as above without dividers.</para></listitem>
<listitem><para><literal>YYYY-DDD</literal> - Ordinal day where DDD is from 001 to 366, e.g. 2016-237.</para></listitem>
<listitem><para><literal>YYYYDDD</literal> - Same as above without dividers.</para></listitem>
<listitem><para><literal>YYYY-Www-D</literal> - Week day where ww is from 01 to 52 and D from 1-7,
e.g. 2016-W34-3.</para></listitem>
<listitem>
<para><literal>YYYYWwwD</literal> - Same as above without dividers.</para>
</listitem>
</itemizedlist>
<para>&lt;time> is in the form:</para>
<itemizedlist>
<listitem><para><literal>hh:mm:ss(.sss)</literal> - Hours, minutes, seconds (subseconds), e.g. 22:10:42.123.</para></listitem>
<listitem>
<para><literal>hhmmss(.sss)</literal> - Same as above without dividers.</para>
</listitem>
</itemizedlist>
<para>&lt;tz> is an optional timezone suffix of the form:</para>
<itemizedlist>
<listitem><para><literal>Z</literal> - UTC.</para></listitem>
<listitem><para><literal>+hh:mm</literal> or <literal>-hh:mm</literal> - Offset from UTC in hours and minutes, e.g. +12:00.</para></listitem>
<listitem>
<para><literal>+hh</literal> or <literal>-hh</literal> - Offset from UTC in hours, e.g. +12.</para>
</listitem>
</itemizedlist>
<para>If the timezone is not provided in <parameter>text</parameter>
 it must be provided in <parameter>default_tz</parameter>

(this field is otherwise ignored).</para>
<para>This call can fail (returning <link linkend="NULL:CAPS"><literal>NULL</literal></link>) if <parameter>text</parameter>
 is not a valid ISO 8601
formatted string.</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-new-from-iso8601.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>text</para></entry>
<entry role="parameter_description"><para>an ISO 8601 formatted time string.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>default_tz</para></entry>
<entry role="parameter_description"><para>a <link linkend="GTimeZone"><type>GTimeZone</type></link> to use if the text doesn't contain a
timezone, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-from-iso8601.returns" role="returns">
<title>Returns</title>
<para>a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>][<acronym>nullable</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.56">2.56</link></para></refsect2>
<refsect2 id="g-date-time-new" role="function" condition="since:2.26">
<title>g_date_time_new&#160;()</title>
<indexterm zone="g-date-time-new" role="2.26"><primary sortas="date_time_new">g_date_time_new</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new (<parameter><link linkend="GTimeZone"><type>GTimeZone</type></link> *tz</parameter>,
                 <parameter><link linkend="gint"><type>gint</type></link> year</parameter>,
                 <parameter><link linkend="gint"><type>gint</type></link> month</parameter>,
                 <parameter><link linkend="gint"><type>gint</type></link> day</parameter>,
                 <parameter><link linkend="gint"><type>gint</type></link> hour</parameter>,
                 <parameter><link linkend="gint"><type>gint</type></link> minute</parameter>,
                 <parameter><link linkend="gdouble"><type>gdouble</type></link> seconds</parameter>);</programlisting>
<para>Creates a new <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given date and time in
the time zone <parameter>tz</parameter>
.</para>
<para>The <parameter>year</parameter>
 must be between 1 and 9999, <parameter>month</parameter>
 between 1 and 12 and <parameter>day</parameter>

between 1 and 28, 29, 30 or 31 depending on the month and the year.</para>
<para><parameter>hour</parameter>
 must be between 0 and 23 and <parameter>minute</parameter>
 must be between 0 and 59.</para>
<para><parameter>seconds</parameter>
 must be at least 0.0 and must be strictly less than 60.0.
It will be rounded down to the nearest microsecond.</para>
<para>If the given time is not representable in the given time zone (for
example, 02:30 on March 14th 2010 in Toronto, due to daylight savings
time) then the time will be rounded up to the nearest existing time
(in this case, 03:00).  If this matters to you then you should verify
the return value for containing the same as the numbers you gave.</para>
<para>In the case that the given time is ambiguous in the given time zone
(for example, 01:30 on November 7th 2010 in Toronto, due to daylight
savings time) then the time falling within standard (ie:
non-daylight) time is taken.</para>
<para>It not considered a programmer error for the values to this function
to be out of range, but in the case that they are, the function will
return <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>tz</para></entry>
<entry role="parameter_description"><para>a <link linkend="GTimeZone"><type>GTimeZone</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>year</para></entry>
<entry role="parameter_description"><para>the year component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>month</para></entry>
<entry role="parameter_description"><para>the month component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>day</para></entry>
<entry role="parameter_description"><para>the day component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hour</para></entry>
<entry role="parameter_description"><para>the hour component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>minute</para></entry>
<entry role="parameter_description"><para>the minute component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>seconds</para></entry>
<entry role="parameter_description"><para>the number of seconds past the minute</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-local" role="function" condition="since:2.26">
<title>g_date_time_new_local&#160;()</title>
<indexterm zone="g-date-time-new-local" role="2.26"><primary sortas="date_time_new_local">g_date_time_new_local</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_local (<parameter><link linkend="gint"><type>gint</type></link> year</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> month</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> day</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> hour</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> minute</parameter>,
                       <parameter><link linkend="gdouble"><type>gdouble</type></link> seconds</parameter>);</programlisting>
<para>Creates a new <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given date and time in
the local time zone.</para>
<para>This call is equivalent to calling <link linkend="g-date-time-new"><function>g_date_time_new()</function></link> with the time
zone returned by <link linkend="g-time-zone-new-local"><function>g_time_zone_new_local()</function></link>.</para>
<refsect3 id="g-date-time-new-local.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>year</para></entry>
<entry role="parameter_description"><para>the year component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>month</para></entry>
<entry role="parameter_description"><para>the month component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>day</para></entry>
<entry role="parameter_description"><para>the day component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hour</para></entry>
<entry role="parameter_description"><para>the hour component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>minute</para></entry>
<entry role="parameter_description"><para>the minute component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>seconds</para></entry>
<entry role="parameter_description"><para>the number of seconds past the minute</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-local.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-new-utc" role="function" condition="since:2.26">
<title>g_date_time_new_utc&#160;()</title>
<indexterm zone="g-date-time-new-utc" role="2.26"><primary sortas="date_time_new_utc">g_date_time_new_utc</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_new_utc (<parameter><link linkend="gint"><type>gint</type></link> year</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> month</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> day</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> hour</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> minute</parameter>,
                     <parameter><link linkend="gdouble"><type>gdouble</type></link> seconds</parameter>);</programlisting>
<para>Creates a new <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the given date and time in
UTC.</para>
<para>This call is equivalent to calling <link linkend="g-date-time-new"><function>g_date_time_new()</function></link> with the time
zone returned by <link linkend="g-time-zone-new-utc"><function>g_time_zone_new_utc()</function></link>.</para>
<refsect3 id="g-date-time-new-utc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>year</para></entry>
<entry role="parameter_description"><para>the year component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>month</para></entry>
<entry role="parameter_description"><para>the month component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>day</para></entry>
<entry role="parameter_description"><para>the day component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hour</para></entry>
<entry role="parameter_description"><para>the hour component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>minute</para></entry>
<entry role="parameter_description"><para>the minute component of the date</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>seconds</para></entry>
<entry role="parameter_description"><para>the number of seconds past the minute</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-new-utc.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add" role="function" condition="since:2.26">
<title>g_date_time_add&#160;()</title>
<indexterm zone="g-date-time-add" role="2.26"><primary sortas="date_time_add">g_date_time_add</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                 <parameter><link linkend="GTimeSpan"><type>GTimeSpan</type></link> timespan</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified timespan to the copy.</para>
<refsect3 id="g-date-time-add.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>timespan</para></entry>
<entry role="parameter_description"><para>a <link linkend="GTimeSpan"><type>GTimeSpan</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-years" role="function" condition="since:2.26">
<title>g_date_time_add_years&#160;()</title>
<indexterm zone="g-date-time-add-years" role="2.26"><primary sortas="date_time_add_years">g_date_time_add_years</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_years (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> years</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified number of years to the
copy. Add negative values to subtract years.</para>
<para>As with <link linkend="g-date-time-add-months"><function>g_date_time_add_months()</function></link>, if the resulting date would be 29th
February on a non-leap year, the day will be clamped to 28th February.</para>
<refsect3 id="g-date-time-add-years.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>years</para></entry>
<entry role="parameter_description"><para>the number of years</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-years.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-months" role="function" condition="since:2.26">
<title>g_date_time_add_months&#160;()</title>
<indexterm zone="g-date-time-add-months" role="2.26"><primary sortas="date_time_add_months">g_date_time_add_months</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_months (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                        <parameter><link linkend="gint"><type>gint</type></link> months</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified number of months to the
copy. Add negative values to subtract months.</para>
<para>The day of the month of the resulting <link linkend="GDateTime"><type>GDateTime</type></link> is clamped to the number
of days in the updated calendar month. For example, if adding 1 month to
31st January 2018, the result would be 28th February 2018. In 2020 (a leap
year), the result would be 29th February.</para>
<refsect3 id="g-date-time-add-months.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>months</para></entry>
<entry role="parameter_description"><para>the number of months</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-months.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-weeks" role="function" condition="since:2.26">
<title>g_date_time_add_weeks&#160;()</title>
<indexterm zone="g-date-time-add-weeks" role="2.26"><primary sortas="date_time_add_weeks">g_date_time_add_weeks</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_weeks (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> weeks</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified number of weeks to the
copy. Add negative values to subtract weeks.</para>
<refsect3 id="g-date-time-add-weeks.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>weeks</para></entry>
<entry role="parameter_description"><para>the number of weeks</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-weeks.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-days" role="function" condition="since:2.26">
<title>g_date_time_add_days&#160;()</title>
<indexterm zone="g-date-time-add-days" role="2.26"><primary sortas="date_time_add_days">g_date_time_add_days</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_days (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> days</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified number of days to the
copy. Add negative values to subtract days.</para>
<refsect3 id="g-date-time-add-days.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>days</para></entry>
<entry role="parameter_description"><para>the number of days</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-days.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-hours" role="function" condition="since:2.26">
<title>g_date_time_add_hours&#160;()</title>
<indexterm zone="g-date-time-add-hours" role="2.26"><primary sortas="date_time_add_hours">g_date_time_add_hours</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_hours (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                       <parameter><link linkend="gint"><type>gint</type></link> hours</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified number of hours.
Add negative values to subtract hours.</para>
<refsect3 id="g-date-time-add-hours.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hours</para></entry>
<entry role="parameter_description"><para>the number of hours to add</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-hours.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-minutes" role="function" condition="since:2.26">
<title>g_date_time_add_minutes&#160;()</title>
<indexterm zone="g-date-time-add-minutes" role="2.26"><primary sortas="date_time_add_minutes">g_date_time_add_minutes</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_minutes (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                         <parameter><link linkend="gint"><type>gint</type></link> minutes</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 adding the specified number of minutes.
Add negative values to subtract minutes.</para>
<refsect3 id="g-date-time-add-minutes.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>minutes</para></entry>
<entry role="parameter_description"><para>the number of minutes to add</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-minutes.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-seconds" role="function" condition="since:2.26">
<title>g_date_time_add_seconds&#160;()</title>
<indexterm zone="g-date-time-add-seconds" role="2.26"><primary sortas="date_time_add_seconds">g_date_time_add_seconds</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_seconds (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                         <parameter><link linkend="gdouble"><type>gdouble</type></link> seconds</parameter>);</programlisting>
<para>Creates a copy of <parameter>datetime</parameter>
 and adds the specified number of seconds.
Add negative values to subtract seconds.</para>
<refsect3 id="g-date-time-add-seconds.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>seconds</para></entry>
<entry role="parameter_description"><para>the number of seconds to add</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-seconds.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> which should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-add-full" role="function" condition="since:2.26">
<title>g_date_time_add_full&#160;()</title>
<indexterm zone="g-date-time-add-full" role="2.26"><primary sortas="date_time_add_full">g_date_time_add_full</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_add_full (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> years</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> months</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> days</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> hours</parameter>,
                      <parameter><link linkend="gint"><type>gint</type></link> minutes</parameter>,
                      <parameter><link linkend="gdouble"><type>gdouble</type></link> seconds</parameter>);</programlisting>
<para>Creates a new <link linkend="GDateTime"><type>GDateTime</type></link> adding the specified values to the current date and
time in <parameter>datetime</parameter>
. Add negative values to subtract.</para>
<refsect3 id="g-date-time-add-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>years</para></entry>
<entry role="parameter_description"><para>the number of years to add</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>months</para></entry>
<entry role="parameter_description"><para>the number of months to add</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>days</para></entry>
<entry role="parameter_description"><para>the number of days to add</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>hours</para></entry>
<entry role="parameter_description"><para>the number of hours to add</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>minutes</para></entry>
<entry role="parameter_description"><para>the number of minutes to add</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>seconds</para></entry>
<entry role="parameter_description"><para>the number of seconds to add</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-add-full.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link> that should be freed with
<link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-compare" role="function" condition="since:2.26">
<title>g_date_time_compare&#160;()</title>
<indexterm zone="g-date-time-compare" role="2.26"><primary sortas="date_time_compare">g_date_time_compare</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_compare (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> dt1</parameter>,
                     <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> dt2</parameter>);</programlisting>
<para>A comparison function for <link linkend="GDateTimes"><type>GDateTimes</type></link> that is suitable
as a <link linkend="GCompareFunc"><type>GCompareFunc</type></link>. Both <link linkend="GDateTimes"><type>GDateTimes</type></link> must be non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<refsect3 id="g-date-time-compare.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dt1</para></entry>
<entry role="parameter_description"><para>first <link linkend="GDateTime"><type>GDateTime</type></link> to compare. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>not nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>dt2</para></entry>
<entry role="parameter_description"><para>second <link linkend="GDateTime"><type>GDateTime</type></link> to compare. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>not nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-compare.returns" role="returns">
<title>Returns</title>
<para> -1, 0 or 1 if <parameter>dt1</parameter>
is less than, equal to or greater
than <parameter>dt2</parameter>
.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-difference" role="function" condition="since:2.26">
<title>g_date_time_difference&#160;()</title>
<indexterm zone="g-date-time-difference" role="2.26"><primary sortas="date_time_difference">g_date_time_difference</primary></indexterm>
<programlisting language="C"><link linkend="GTimeSpan"><returnvalue>GTimeSpan</returnvalue></link>
g_date_time_difference (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *end</parameter>,
                        <parameter><link linkend="GDateTime"><type>GDateTime</type></link> *begin</parameter>);</programlisting>
<para>Calculates the difference in time between <parameter>end</parameter>
 and <parameter>begin</parameter>
.  The
<link linkend="GTimeSpan"><type>GTimeSpan</type></link> that is returned is effectively <parameter>end</parameter>
 - <parameter>begin</parameter>
 (ie:
positive if the first parameter is larger).</para>
<refsect3 id="g-date-time-difference.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>end</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>begin</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-difference.returns" role="returns">
<title>Returns</title>
<para> the difference between the two <link linkend="GDateTime"><type>GDateTime</type></link>, as a time
span expressed in microseconds.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-hash" role="function" condition="since:2.26">
<title>g_date_time_hash&#160;()</title>
<indexterm zone="g-date-time-hash" role="2.26"><primary sortas="date_time_hash">g_date_time_hash</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_date_time_hash (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> datetime</parameter>);</programlisting>
<para>Hashes <parameter>datetime</parameter>
 into a <link linkend="guint"><type>guint</type></link>, suitable for use within <link linkend="GHashTable"><type>GHashTable</type></link>.</para>
<refsect3 id="g-date-time-hash.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>not nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-hash.returns" role="returns">
<title>Returns</title>
<para> a <link linkend="guint"><type>guint</type></link> containing the hash</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-equal" role="function" condition="since:2.26">
<title>g_date_time_equal&#160;()</title>
<indexterm zone="g-date-time-equal" role="2.26"><primary sortas="date_time_equal">g_date_time_equal</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_date_time_equal (<parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> dt1</parameter>,
                   <parameter><link linkend="gconstpointer"><type>gconstpointer</type></link> dt2</parameter>);</programlisting>
<para>Checks to see if <parameter>dt1</parameter>
 and <parameter>dt2</parameter>
 are equal.</para>
<para>Equal here means that they represent the same moment after converting
them to the same time zone.</para>
<refsect3 id="g-date-time-equal.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>dt1</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>not nullable</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>dt2</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>not nullable</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-equal.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if <parameter>dt1</parameter>
and <parameter>dt2</parameter>
are equal</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-ymd" role="function" condition="since:2.26">
<title>g_date_time_get_ymd&#160;()</title>
<indexterm zone="g-date-time-get-ymd" role="2.26"><primary sortas="date_time_get_ymd">g_date_time_get_ymd</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_date_time_get_ymd (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> *year</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> *month</parameter>,
                     <parameter><link linkend="gint"><type>gint</type></link> *day</parameter>);</programlisting>
<para>Retrieves the Gregorian day, month, and year of a given <link linkend="GDateTime"><type>GDateTime</type></link>.</para>
<refsect3 id="g-date-time-get-ymd.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>year</para></entry>
<entry role="parameter_description"><para>the return location for the gregorian year, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>month</para></entry>
<entry role="parameter_description"><para>the return location for the month of the year, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>day</para></entry>
<entry role="parameter_description"><para>the return location for the day of the month, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>out</acronym>][<acronym>optional</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-year" role="function" condition="since:2.26">
<title>g_date_time_get_year&#160;()</title>
<indexterm zone="g-date-time-get-year" role="2.26"><primary sortas="date_time_get_year">g_date_time_get_year</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_year (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the year represented by <parameter>datetime</parameter>
 in the Gregorian calendar.</para>
<refsect3 id="g-date-time-get-year.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>A <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-year.returns" role="returns">
<title>Returns</title>
<para> the year represented by <parameter>datetime</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-month" role="function" condition="since:2.26">
<title>g_date_time_get_month&#160;()</title>
<indexterm zone="g-date-time-get-month" role="2.26"><primary sortas="date_time_get_month">g_date_time_get_month</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_month (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the month of the year represented by <parameter>datetime</parameter>
 in the Gregorian
calendar.</para>
<refsect3 id="g-date-time-get-month.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-month.returns" role="returns">
<title>Returns</title>
<para> the month represented by <parameter>datetime</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-day-of-month" role="function" condition="since:2.26">
<title>g_date_time_get_day_of_month&#160;()</title>
<indexterm zone="g-date-time-get-day-of-month" role="2.26"><primary sortas="date_time_get_day_of_month">g_date_time_get_day_of_month</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_day_of_month (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the day of the month represented by <parameter>datetime</parameter>
 in the gregorian
calendar.</para>
<refsect3 id="g-date-time-get-day-of-month.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-day-of-month.returns" role="returns">
<title>Returns</title>
<para> the day of the month</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-week-numbering-year" role="function" condition="since:2.26">
<title>g_date_time_get_week_numbering_year&#160;()</title>
<indexterm zone="g-date-time-get-week-numbering-year" role="2.26"><primary sortas="date_time_get_week_numbering_year">g_date_time_get_week_numbering_year</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_week_numbering_year (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Returns the ISO 8601 week-numbering year in which the week containing
<parameter>datetime</parameter>
 falls.</para>
<para>This function, taken together with <link linkend="g-date-time-get-week-of-year"><function>g_date_time_get_week_of_year()</function></link> and
<link linkend="g-date-time-get-day-of-week"><function>g_date_time_get_day_of_week()</function></link> can be used to determine the full ISO
week date on which <parameter>datetime</parameter>
 falls.</para>
<para>This is usually equal to the normal Gregorian year (as returned by
<link linkend="g-date-time-get-year"><function>g_date_time_get_year()</function></link>), except as detailed below:</para>
<para>For Thursday, the week-numbering year is always equal to the usual
calendar year.  For other days, the number is such that every day
within a complete week (Monday to Sunday) is contained within the
same week-numbering year.</para>
<para>For Monday, Tuesday and Wednesday occurring near the end of the year,
this may mean that the week-numbering year is one greater than the
calendar year (so that these days have the same week-numbering year
as the Thursday occurring early in the next year).</para>
<para>For Friday, Saturday and Sunday occurring near the start of the year,
this may mean that the week-numbering year is one less than the
calendar year (so that these days have the same week-numbering year
as the Thursday occurring late in the previous year).</para>
<para>An equivalent description is that the week-numbering year is equal to
the calendar year containing the majority of the days in the current
week (Monday to Sunday).</para>
<para>Note that January 1 0001 in the proleptic Gregorian calendar is a
Monday, so this function never returns 0.</para>
<refsect3 id="g-date-time-get-week-numbering-year.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-week-numbering-year.returns" role="returns">
<title>Returns</title>
<para> the ISO 8601 week-numbering year for <parameter>datetime</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-week-of-year" role="function" condition="since:2.26">
<title>g_date_time_get_week_of_year&#160;()</title>
<indexterm zone="g-date-time-get-week-of-year" role="2.26"><primary sortas="date_time_get_week_of_year">g_date_time_get_week_of_year</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_week_of_year (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Returns the ISO 8601 week number for the week containing <parameter>datetime</parameter>
.
The ISO 8601 week number is the same for every day of the week (from
Moday through Sunday).  That can produce some unusual results
(described below).</para>
<para>The first week of the year is week 1.  This is the week that contains
the first Thursday of the year.  Equivalently, this is the first week
that has more than 4 of its days falling within the calendar year.</para>
<para>The value 0 is never returned by this function.  Days contained
within a year but occurring before the first ISO 8601 week of that
year are considered as being contained in the last week of the
previous year.  Similarly, the final days of a calendar year may be
considered as being part of the first ISO 8601 week of the next year
if 4 or more days of that week are contained within the new year.</para>
<refsect3 id="g-date-time-get-week-of-year.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-week-of-year.returns" role="returns">
<title>Returns</title>
<para> the ISO 8601 week number for <parameter>datetime</parameter>
.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-day-of-week" role="function" condition="since:2.26">
<title>g_date_time_get_day_of_week&#160;()</title>
<indexterm zone="g-date-time-get-day-of-week" role="2.26"><primary sortas="date_time_get_day_of_week">g_date_time_get_day_of_week</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_day_of_week (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the ISO 8601 day of the week on which <parameter>datetime</parameter>
 falls (1 is
Monday, 2 is Tuesday... 7 is Sunday).</para>
<refsect3 id="g-date-time-get-day-of-week.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-day-of-week.returns" role="returns">
<title>Returns</title>
<para> the day of the week</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-day-of-year" role="function" condition="since:2.26">
<title>g_date_time_get_day_of_year&#160;()</title>
<indexterm zone="g-date-time-get-day-of-year" role="2.26"><primary sortas="date_time_get_day_of_year">g_date_time_get_day_of_year</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_day_of_year (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the day of the year represented by <parameter>datetime</parameter>
 in the Gregorian
calendar.</para>
<refsect3 id="g-date-time-get-day-of-year.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-day-of-year.returns" role="returns">
<title>Returns</title>
<para> the day of the year</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-hour" role="function" condition="since:2.26">
<title>g_date_time_get_hour&#160;()</title>
<indexterm zone="g-date-time-get-hour" role="2.26"><primary sortas="date_time_get_hour">g_date_time_get_hour</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_hour (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the hour of the day represented by <parameter>datetime</parameter>
</para>
<refsect3 id="g-date-time-get-hour.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-hour.returns" role="returns">
<title>Returns</title>
<para> the hour of the day</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-minute" role="function" condition="since:2.26">
<title>g_date_time_get_minute&#160;()</title>
<indexterm zone="g-date-time-get-minute" role="2.26"><primary sortas="date_time_get_minute">g_date_time_get_minute</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_minute (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the minute of the hour represented by <parameter>datetime</parameter>
</para>
<refsect3 id="g-date-time-get-minute.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-minute.returns" role="returns">
<title>Returns</title>
<para> the minute of the hour</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-second" role="function" condition="since:2.26">
<title>g_date_time_get_second&#160;()</title>
<indexterm zone="g-date-time-get-second" role="2.26"><primary sortas="date_time_get_second">g_date_time_get_second</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_second (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the second of the minute represented by <parameter>datetime</parameter>
</para>
<refsect3 id="g-date-time-get-second.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-second.returns" role="returns">
<title>Returns</title>
<para> the second represented by <parameter>datetime</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-microsecond" role="function" condition="since:2.26">
<title>g_date_time_get_microsecond&#160;()</title>
<indexterm zone="g-date-time-get-microsecond" role="2.26"><primary sortas="date_time_get_microsecond">g_date_time_get_microsecond</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
g_date_time_get_microsecond (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the microsecond of the date represented by <parameter>datetime</parameter>
</para>
<refsect3 id="g-date-time-get-microsecond.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-microsecond.returns" role="returns">
<title>Returns</title>
<para> the microsecond of the second</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-seconds" role="function" condition="since:2.26">
<title>g_date_time_get_seconds&#160;()</title>
<indexterm zone="g-date-time-get-seconds" role="2.26"><primary sortas="date_time_get_seconds">g_date_time_get_seconds</primary></indexterm>
<programlisting language="C"><link linkend="gdouble"><returnvalue>gdouble</returnvalue></link>
g_date_time_get_seconds (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Retrieves the number of seconds since the start of the last minute,
including the fractional part.</para>
<refsect3 id="g-date-time-get-seconds.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-seconds.returns" role="returns">
<title>Returns</title>
<para> the number of seconds</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-to-unix" role="function" condition="since:2.26">
<title>g_date_time_to_unix&#160;()</title>
<indexterm zone="g-date-time-to-unix" role="2.26"><primary sortas="date_time_to_unix">g_date_time_to_unix</primary></indexterm>
<programlisting language="C"><link linkend="gint64"><returnvalue>gint64</returnvalue></link>
g_date_time_to_unix (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Gives the Unix time corresponding to <parameter>datetime</parameter>
, rounding down to the
nearest second.</para>
<para>Unix time is the number of seconds that have elapsed since 1970-01-01
00:00:00 UTC, regardless of the time zone associated with <parameter>datetime</parameter>
.</para>
<refsect3 id="g-date-time-to-unix.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-to-unix.returns" role="returns">
<title>Returns</title>
<para> the Unix time corresponding to <parameter>datetime</parameter>
</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-utc-offset" role="function" condition="since:2.26">
<title>g_date_time_get_utc_offset&#160;()</title>
<indexterm zone="g-date-time-get-utc-offset" role="2.26"><primary sortas="date_time_get_utc_offset">g_date_time_get_utc_offset</primary></indexterm>
<programlisting language="C"><link linkend="GTimeSpan"><returnvalue>GTimeSpan</returnvalue></link>
g_date_time_get_utc_offset (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Determines the offset to UTC in effect at the time and in the time
zone of <parameter>datetime</parameter>
.</para>
<para>The offset is the number of microseconds that you add to UTC time to
arrive at local time for the time zone (ie: negative numbers for time
zones west of GMT, positive numbers for east).</para>
<para>If <parameter>datetime</parameter>
 represents UTC time, then the offset is always zero.</para>
<refsect3 id="g-date-time-get-utc-offset.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-utc-offset.returns" role="returns">
<title>Returns</title>
<para> the number of microseconds that should be added to UTC to
get the local time</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-get-timezone" role="function" condition="since:2.58">
<title>g_date_time_get_timezone&#160;()</title>
<indexterm zone="g-date-time-get-timezone" role="2.58"><primary sortas="date_time_get_timezone">g_date_time_get_timezone</primary></indexterm>
<programlisting language="C"><link linkend="GTimeZone"><returnvalue>GTimeZone</returnvalue></link>&#160;*
g_date_time_get_timezone (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Get the time zone for this <parameter>datetime</parameter>
.</para>
<refsect3 id="g-date-time-get-timezone.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-timezone.returns" role="returns">
<title>Returns</title>
<para>the time zone. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.58">2.58</link></para></refsect2>
<refsect2 id="g-date-time-get-timezone-abbreviation" role="function" condition="since:2.26">
<title>g_date_time_get_timezone_abbreviation&#160;()</title>
<indexterm zone="g-date-time-get-timezone-abbreviation" role="2.26"><primary sortas="date_time_get_timezone_abbreviation">g_date_time_get_timezone_abbreviation</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_date_time_get_timezone_abbreviation (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Determines the time zone abbreviation to be used at the time and in
the time zone of <parameter>datetime</parameter>
.</para>
<para>For example, in Toronto this is currently "EST" during the winter
months and "EDT" during the summer months when daylight savings
time is in effect.</para>
<refsect3 id="g-date-time-get-timezone-abbreviation.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-get-timezone-abbreviation.returns" role="returns">
<title>Returns</title>
<para>the time zone abbreviation. The returned
string is owned by the <link linkend="GDateTime"><type>GDateTime</type></link> and it should not be
modified or freed. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-is-daylight-savings" role="function" condition="since:2.26">
<title>g_date_time_is_daylight_savings&#160;()</title>
<indexterm zone="g-date-time-is-daylight-savings" role="2.26"><primary sortas="date_time_is_daylight_savings">g_date_time_is_daylight_savings</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_date_time_is_daylight_savings (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Determines if daylight savings time is in effect at the time and in
the time zone of <parameter>datetime</parameter>
.</para>
<refsect3 id="g-date-time-is-daylight-savings.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-is-daylight-savings.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if daylight savings time is in effect</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-to-timezone" role="function" condition="since:2.26">
<title>g_date_time_to_timezone&#160;()</title>
<indexterm zone="g-date-time-to-timezone" role="2.26"><primary sortas="date_time_to_timezone">g_date_time_to_timezone</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_to_timezone (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                         <parameter><link linkend="GTimeZone"><type>GTimeZone</type></link> *tz</parameter>);</programlisting>
<para>Create a new <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the same instant in time as
<parameter>datetime</parameter>
, but in the time zone <parameter>tz</parameter>
.</para>
<para>This call can fail in the case that the time goes out of bounds.  For
example, converting 0001-01-01 00:00:00 UTC to a time zone west of
Greenwich will fail (due to the year 0 being out of range).</para>
<para>You should release the return value by calling <link linkend="g-date-time-unref"><function>g_date_time_unref()</function></link>
when you are done with it.</para>
<refsect3 id="g-date-time-to-timezone.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>tz</para></entry>
<entry role="parameter_description"><para>the new <link linkend="GTimeZone"><type>GTimeZone</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-to-timezone.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GDateTime"><type>GDateTime</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-to-local" role="function" condition="since:2.26">
<title>g_date_time_to_local&#160;()</title>
<indexterm zone="g-date-time-to-local" role="2.26"><primary sortas="date_time_to_local">g_date_time_to_local</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_to_local (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Creates a new <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the same instant in time as
<parameter>datetime</parameter>
, but in the local time zone.</para>
<para>This call is equivalent to calling <link linkend="g-date-time-to-timezone"><function>g_date_time_to_timezone()</function></link> with the
time zone returned by <link linkend="g-time-zone-new-local"><function>g_time_zone_new_local()</function></link>.</para>
<refsect3 id="g-date-time-to-local.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-to-local.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-to-utc" role="function" condition="since:2.26">
<title>g_date_time_to_utc&#160;()</title>
<indexterm zone="g-date-time-to-utc" role="2.26"><primary sortas="date_time_to_utc">g_date_time_to_utc</primary></indexterm>
<programlisting language="C"><link linkend="GDateTime"><returnvalue>GDateTime</returnvalue></link>&#160;*
g_date_time_to_utc (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Creates a new <link linkend="GDateTime"><type>GDateTime</type></link> corresponding to the same instant in time as
<parameter>datetime</parameter>
, but in UTC.</para>
<para>This call is equivalent to calling <link linkend="g-date-time-to-timezone"><function>g_date_time_to_timezone()</function></link> with the
time zone returned by <link linkend="g-time-zone-new-utc"><function>g_time_zone_new_utc()</function></link>.</para>
<refsect3 id="g-date-time-to-utc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-to-utc.returns" role="returns">
<title>Returns</title>
<para> the newly created <link linkend="GDateTime"><type>GDateTime</type></link></para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-format" role="function" condition="since:2.26">
<title>g_date_time_format&#160;()</title>
<indexterm zone="g-date-time-format" role="2.26"><primary sortas="date_time_format">g_date_time_format</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_date_time_format (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>,
                    <parameter>const <link linkend="gchar"><type>gchar</type></link> *format</parameter>);</programlisting>
<para>Creates a newly allocated string representing the requested <parameter>format</parameter>
.</para>
<para>The format strings understood by this function are a subset of the
<link linkend="strftime"><function>strftime()</function></link> format language as specified by C99.  The %D, %U and %W
conversions are not supported, nor is the 'E' modifier.  The GNU
extensions %k, %l, %s and %P are supported, however, as are the
'0', '_' and '-' modifiers.</para>
<para>In contrast to <link linkend="strftime"><function>strftime()</function></link>, this function always produces a UTF-8
string, regardless of the current locale.  Note that the rendering of
many formats is locale-dependent and may not match the <link linkend="strftime"><function>strftime()</function></link>
output exactly.</para>
<para>The following format specifiers are supported:</para>
<itemizedlist>
<listitem><para>%a: the abbreviated weekday name according to the current locale</para></listitem>
<listitem><para>%A: the full weekday name according to the current locale</para></listitem>
<listitem><para>%b: the abbreviated month name according to the current locale</para></listitem>
<listitem><para>%B: the full month name according to the current locale</para></listitem>
<listitem><para>%c: the preferred date and time representation for the current locale</para></listitem>
<listitem><para>%C: the century number (year/100) as a 2-digit integer (00-99)</para></listitem>
<listitem><para>%d: the day of the month as a decimal number (range 01 to 31)</para></listitem>
<listitem><para>%e: the day of the month as a decimal number (range  1 to 31)</para></listitem>
<listitem><para>%F: equivalent to <literal>%Y-%m-%d</literal> (the ISO 8601 date format)</para></listitem>
<listitem><para>%g: the last two digits of the ISO 8601 week-based year as a
decimal number (00-99). This works well with %V and %u.</para></listitem>
<listitem><para>%G: the ISO 8601 week-based year as a decimal number. This works
well with %V and %u.</para></listitem>
<listitem><para>%h: equivalent to %b</para></listitem>
<listitem><para>%H: the hour as a decimal number using a 24-hour clock (range 00 to 23)</para></listitem>
<listitem><para>%I: the hour as a decimal number using a 12-hour clock (range 01 to 12)</para></listitem>
<listitem><para>%j: the day of the year as a decimal number (range 001 to 366)</para></listitem>
<listitem><para>%k: the hour (24-hour clock) as a decimal number (range 0 to 23);
single digits are preceded by a blank</para></listitem>
<listitem><para>%l: the hour (12-hour clock) as a decimal number (range 1 to 12);
single digits are preceded by a blank</para></listitem>
<listitem><para>%m: the month as a decimal number (range 01 to 12)</para></listitem>
<listitem><para>%M: the minute as a decimal number (range 00 to 59)</para></listitem>
<listitem><para>%p: either "AM" or "PM" according to the given time value, or the
corresponding  strings for the current locale.  Noon is treated as
"PM" and midnight as "AM".</para></listitem>
<listitem><para>%P: like %p but lowercase: "am" or "pm" or a corresponding string for
the current locale</para></listitem>
<listitem><para>%r: the time in a.m. or p.m. notation</para></listitem>
<listitem><para>%R: the time in 24-hour notation (%H:%M)</para></listitem>
<listitem><para>%s: the number of seconds since the Epoch, that is, since 1970-01-01
00:00:00 UTC</para></listitem>
<listitem><para>%S: the second as a decimal number (range 00 to 60)</para></listitem>
<listitem><para>%t: a tab character</para></listitem>
<listitem><para>%T: the time in 24-hour notation with seconds (%H:%M:%S)</para></listitem>
<listitem><para>%u: the ISO 8601 standard day of the week as a decimal, range 1 to 7,
Monday being 1. This works well with %G and %V.</para></listitem>
<listitem><para>%V: the ISO 8601 standard week number of the current year as a decimal
number, range 01 to 53, where week 1 is the first week that has at
least 4 days in the new year. See <link linkend="g-date-time-get-week-of-year"><function>g_date_time_get_week_of_year()</function></link>.
This works well with %G and %u.</para></listitem>
<listitem><para>%w: the day of the week as a decimal, range 0 to 6, Sunday being 0.
This is not the ISO 8601 standard format -- use %u instead.</para></listitem>
<listitem><para>%x: the preferred date representation for the current locale without
the time</para></listitem>
<listitem><para>%X: the preferred time representation for the current locale without
the date</para></listitem>
<listitem><para>%y: the year as a decimal number without the century</para></listitem>
<listitem><para>%Y: the year as a decimal number including the century</para></listitem>
<listitem><para>%z: the time zone as an offset from UTC (+hhmm)</para></listitem>
<listitem><para>%:z: the time zone as an offset from UTC (+hh:mm).
This is a gnulib <link linkend="strftime"><function>strftime()</function></link> extension. Since: 2.38</para></listitem>
<listitem><para>%::z: the time zone as an offset from UTC (+hh:mm:ss). This is a
gnulib <link linkend="strftime"><function>strftime()</function></link> extension. Since: 2.38</para></listitem>
<listitem><para>%:::z: the time zone as an offset from UTC, with : to necessary
precision (e.g., -04, +05:30). This is a gnulib <link linkend="strftime"><function>strftime()</function></link> extension. Since: 2.38</para></listitem>
<listitem><para>%Z: the time zone or name or abbreviation</para></listitem>
<listitem>
<para>%%: a literal % character</para>
</listitem>
</itemizedlist>
<para>Some conversion specifications can be modified by preceding the
conversion specifier by one or more modifier characters. The
following modifiers are supported for many of the numeric
conversions:</para>
<itemizedlist>
<listitem><para>O: Use alternative numeric symbols, if the current locale supports those.</para></listitem>
<listitem><para>_: Pad a numeric result with spaces. This overrides the default padding
for the specifier.</para></listitem>
<listitem><para>-: Do not pad a numeric result. This overrides the default padding
for the specifier.</para></listitem>
<listitem>
<para>0: Pad a numeric result with zeros. This overrides the default padding
for the specifier.</para>
</listitem>
</itemizedlist>
<para>Additionally, when O is used with B, b, or h, it produces the alternative
form of a month name. The alternative form should be used when the month
name is used without a day number (e.g., standalone). It is required in
some languages (Baltic, Slavic, Greek, and more) due to their grammatical
rules. For other languages there is no difference. %OB is a GNU and BSD
<link linkend="strftime"><function>strftime()</function></link> extension expected to be added to the future POSIX specification,
%Ob and %Oh are GNU <link linkend="strftime"><function>strftime()</function></link> extensions. Since: 2.56</para>
<refsect3 id="g-date-time-format.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>A <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>format</para></entry>
<entry role="parameter_description"><para>a valid UTF-8 string, containing the format for the
<link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-format.returns" role="returns">
<title>Returns</title>
<para> a newly allocated string formatted to the requested format
or <link linkend="NULL:CAPS"><literal>NULL</literal></link> in the case that there was an error (such as a format specifier
not being supported in the current locale). The string
should be freed with <link linkend="g-free"><function>g_free()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="g-date-time-format-iso8601" role="function" condition="since:2.62">
<title>g_date_time_format_iso8601&#160;()</title>
<indexterm zone="g-date-time-format-iso8601" role="2.62"><primary sortas="date_time_format_iso8601">g_date_time_format_iso8601</primary></indexterm>
<programlisting language="C"><link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
g_date_time_format_iso8601 (<parameter><link linkend="GDateTime"><type>GDateTime</type></link> *datetime</parameter>);</programlisting>
<para>Format <parameter>datetime</parameter>
 in <ulink url="https://en.wikipedia.org/wiki/ISO_8601">ISO 8601 format</ulink>,
including the date, time and time zone, and return that as a UTF-8 encoded
string.</para>
<refsect3 id="g-date-time-format-iso8601.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>datetime</para></entry>
<entry role="parameter_description"><para>A <link linkend="GDateTime"><type>GDateTime</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-date-time-format-iso8601.returns" role="returns">
<title>Returns</title>
<para> a newly allocated string formatted in ISO 8601 format
or <link linkend="NULL:CAPS"><literal>NULL</literal></link> in the case that there was an error. The string
should be freed with <link linkend="g-free"><function>g_free()</function></link>.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.62">2.62</link></para></refsect2>

</refsect1>
<refsect1 id="glib-GDateTime.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GTimeSpan" role="typedef" condition="since:2.26">
<title>GTimeSpan</title>
<indexterm zone="GTimeSpan" role="2.26"><primary sortas="TimeSpan">GTimeSpan</primary></indexterm>
<programlisting language="C">typedef gint64 GTimeSpan;
</programlisting>
<para>A value representing an interval of time, in microseconds.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="G-TIME-SPAN-DAY:CAPS" role="macro" condition="since:2.26">
<title>G_TIME_SPAN_DAY</title>
<indexterm zone="G-TIME-SPAN-DAY:CAPS" role="2.26"><primary sortas="TIME_SPAN_DAY">G_TIME_SPAN_DAY</primary></indexterm>
<programlisting language="C">#define G_TIME_SPAN_DAY                 (G_GINT64_CONSTANT (86400000000))
</programlisting>
<para>Evaluates to a time span of one day.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="G-TIME-SPAN-HOUR:CAPS" role="macro" condition="since:2.26">
<title>G_TIME_SPAN_HOUR</title>
<indexterm zone="G-TIME-SPAN-HOUR:CAPS" role="2.26"><primary sortas="TIME_SPAN_HOUR">G_TIME_SPAN_HOUR</primary></indexterm>
<programlisting language="C">#define G_TIME_SPAN_HOUR                (G_GINT64_CONSTANT (3600000000))
</programlisting>
<para>Evaluates to a time span of one hour.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="G-TIME-SPAN-MINUTE:CAPS" role="macro" condition="since:2.26">
<title>G_TIME_SPAN_MINUTE</title>
<indexterm zone="G-TIME-SPAN-MINUTE:CAPS" role="2.26"><primary sortas="TIME_SPAN_MINUTE">G_TIME_SPAN_MINUTE</primary></indexterm>
<programlisting language="C">#define G_TIME_SPAN_MINUTE              (G_GINT64_CONSTANT (60000000))
</programlisting>
<para>Evaluates to a time span of one minute.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="G-TIME-SPAN-SECOND:CAPS" role="macro" condition="since:2.26">
<title>G_TIME_SPAN_SECOND</title>
<indexterm zone="G-TIME-SPAN-SECOND:CAPS" role="2.26"><primary sortas="TIME_SPAN_SECOND">G_TIME_SPAN_SECOND</primary></indexterm>
<programlisting language="C">#define G_TIME_SPAN_SECOND              (G_GINT64_CONSTANT (1000000))
</programlisting>
<para>Evaluates to a time span of one second.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="G-TIME-SPAN-MILLISECOND:CAPS" role="macro" condition="since:2.26">
<title>G_TIME_SPAN_MILLISECOND</title>
<indexterm zone="G-TIME-SPAN-MILLISECOND:CAPS" role="2.26"><primary sortas="TIME_SPAN_MILLISECOND">G_TIME_SPAN_MILLISECOND</primary></indexterm>
<programlisting language="C">#define G_TIME_SPAN_MILLISECOND         (G_GINT64_CONSTANT (1000))
</programlisting>
<para>Evaluates to a time span of one millisecond.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>
<refsect2 id="GDateTime" role="struct" condition="since:2.26">
<title>GDateTime</title>
<indexterm zone="GDateTime" role="2.26"><primary sortas="DateTime">GDateTime</primary></indexterm>
<programlisting language="C">typedef struct _GDateTime GDateTime;</programlisting>
<para><literal>GDateTime</literal> is an opaque structure whose members
cannot be accessed directly.</para>
<para role="since">Since: <link linkend="api-index-2.26">2.26</link></para></refsect2>

</refsect1>
<refsect1 id="glib-GDateTime.see-also">
<title>See Also</title>
<para><link linkend="GTimeZone"><type>GTimeZone</type></link></para>

</refsect1>

</refentry>
