Home

GDateTime

GDateTime is a date and time representation provided by GLib, the core utility library used by GNOME and many GTK-based applications. It stores a specific moment in time along with a time zone, enabling consistent handling of dates and times across platforms and locales.

GDateTime is a boxed, reference-counted type. Instances are created via constructor helpers that can specify calendar

The API allows access to the individual components of the timestamp, such as year, month, day, hour,

GDateTime integrates with GLib’s broader time utilities, including support for time zone conversions and interoperability with

Historically, GDateTime is part of GLib’s date and time API and is widely used in GNOME-based software,

components
(year,
month,
day,
hour,
minute,
second),
or
obtain
the
current
time
in
UTC
or
the
local
time
zone,
or
be
created
from
Unix
epoch
seconds.
A
GTimeZone
object
can
be
supplied
to
choose
or
change
the
associated
time
zone.
minute,
and
second,
as
well
as
information
about
the
time
zone.
It
also
provides
comparison
operations
to
determine
ordering
or
equality
between
two
GDateTime
values.
In
addition,
GDateTime
can
be
formatted
to
human-readable
strings
using
locale-aware
formatting
functions,
enabling
output
suitable
for
user
interfaces
and
logging.
other
time
representations.
This
makes
it
a
convenient
choice
for
applications
that
must
display,
compare,
store,
or
transform
dates
and
times
in
a
cross-platform,
locale-sensitive
manner.
as
well
as
in
libraries
and
applications
built
on
GLib.
It
complements
lower-level
time
representations
by
providing
a
portable,
high-level
interface
for
date-time
arithmetic,
formatting,
and
time
zone
handling.