DateTime
Object Hierarchy:
Description:
[ CCode ( ref_function = "gst_date_time_ref" , type_id = "gst_date_time_get_type ()" , unref_function = "gst_date_time_unref" ) ]
[ Compact ]
public class DateTime
Struct to store date, time and timezone information altogether.
DateTime is refcounted and immutable.
Date information is handled using the [proleptic Gregorian calendar].
Provides basic creation functions and accessor functions to its fields.
[proleptic Gregorian calendar]: https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
Content:
Creation methods:
- public DateTime (float tzoffset, int year, int month, int day, int hour, int minute, double seconds)
Creates a new DateTime using the date and
times in the gregorian calendar in the supplied timezone.
- public DateTime.from_g_date_time (owned DateTime? dt)
Creates a new DateTime from a
DateTime object.
- public DateTime.from_iso8601_string (string string)
Tries to parse common variants of ISO-8601 datetime strings into a
DateTime.
- public DateTime.from_unix_epoch_local_time (int64 secs)
Creates a new DateTime using the time since
Jan 1, 1970 specified by secs
.
- public DateTime.from_unix_epoch_local_time_usecs (int64 usecs)
Creates a new DateTime using the time since
Jan 1, 1970 specified by usecs
.
- public DateTime.from_unix_epoch_utc (int64 secs)
Creates a new DateTime using the time since
Jan 1, 1970 specified by secs
.
- public DateTime.from_unix_epoch_utc_usecs (int64 usecs)
Creates a new DateTime using the time since
Jan 1, 1970 specified by usecs
.
- public DateTime.local_time (int year, int month, int day, int hour, int minute, double seconds)
Creates a new DateTime using the date and
times in the gregorian calendar in the local timezone.
- public DateTime.now_local_time ()
Creates a new DateTime representing the
current date and time.
- public DateTime.now_utc ()
Creates a new DateTime that represents the
current instant at Universal coordinated time.
- public DateTime.y (int year)
Creates a new DateTime using the date and
times in the gregorian calendar in the local timezone.
- public DateTime.ym (int year, int month)
Creates a new DateTime using the date and
times in the gregorian calendar in the local timezone.
- public DateTime.ymd (int year, int month, int day)
Creates a new DateTime using the date and
times in the gregorian calendar in the local timezone.
Methods:
- public unowned DateTime @ref ()
Atomically increments the reference count of
this by one.
- public int get_day ()
Returns the day of the month of this DateTime
.
- public int get_hour ()
Retrieves the hour of the day represented by
this in the gregorian calendar.
- public int get_microsecond ()
Retrieves the fractional part of the seconds in microseconds
represented by this in the gregorian calendar.
- public int get_minute ()
Retrieves the minute of the hour represented by
this in the gregorian calendar.
- public int get_month ()
Returns the month of this DateTime.
- public int get_second ()
Retrieves the second of the minute represented by
this in the gregorian calendar.
- public float get_time_zone_offset ()
Retrieves the offset from UTC in hours that the timezone specified by
this represents.
- public int get_year ()
Returns the year of this DateTime.
- public bool has_day ()
- public bool has_month ()
- public bool has_second ()
- public bool has_time ()
- public bool has_year ()
- public DateTime? to_g_date_time ()
Creates a new DateTime from a fully defined
DateTime object.
- public string? to_iso8601_string ()
Create a minimal string compatible with ISO-8601.
- public void unref ()
Atomically decrements the reference count of
this by one.