Date and Time Functions

Date and Time Functions — Date/time helper functions

Functions

Description

This section provides a few functions to help with displaying dates and times in an easily readable way.

Functions

dzl_g_date_time_format_for_display ()

gchar *
dzl_g_date_time_format_for_display (GDateTime *self);

Helper function to create a human-friendly string describing approximately how long ago a GDateTime is.

Parameters

self

A GDateTime

 

Returns

A newly allocated string describing the date and time imprecisely such as "Yesterday".

[transfer full]


dzl_g_time_span_to_label ()

gchar *
dzl_g_time_span_to_label (GTimeSpan span);

Creates a string describing the time span in hours, minutes, and seconds. For example, a time span of three and a half minutes would be "3:30". 2 days, 3 hours, 6 minutes, and 20 seconds would be "51:06:20".

Parameters

span

the span of time

 

Returns

A newly allocated string describing the time span.

[transfer full]


dzl_g_time_span_to_label_mapping ()

gboolean
dzl_g_time_span_to_label_mapping (GBinding *binding,
                                  const GValue *from_value,
                                  GValue *to_value,
                                  gpointer user_data);

A GBindingTransformFunc to transform a time span into a string label using dzl_g_time_span_to_label().