DateTime
Description:
public namespace DateTime
The DateTime namespace contains useful functions for getting the default translated format for either date and time.
Content:
Methods:
- public string get_default_date_format (bool with_weekday = false, bool with_day = true, bool with_year = false)
Gets the default translated date format. The function constructs a new
string interpreting the with_weekday, with_day and with_year parameters so that it can be used with formatting
functions like GLib.DateTime.format.
- public string get_default_time_format (bool is_12h = false, bool with_second = false)
Gets a default translated time format. The function constructs a new
string interpreting the is_12h and with_second parameters so that it can be used with formatting functions like
GLib.DateTime.format.
- public string get_relative_datetime (DateTime date_time)
Compares a GLib.DateTime to
GLib.DateTime.now_local
and returns a location, relative date and time string. Results appear as natural-language strings
like "Now", "5m ago", "Yesterday"
- public bool is_same_day (DateTime day1, DateTime day2)
Compare two GLib.DateTime and return true
if they occur on the same day of the same year
- public string seconds_to_time (int seconds)
Converts seconds into the ISO 8601 standard date format for minutes
(e.g. 100s to 01:40). Output of negative seconds is prepended with minus character.