DateTime

GDateTime is an opaque structure whose members cannot be accessed directly.

Constructors

this
this(GDateTime* gDateTime, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(long t, bool utc)

Creates a DateTime corresponding to the given Unix time t Unix time is the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC, regardless of the local time offset.

this
this(GTimeVal tv, bool utc)

Creates a DateTime corresponding to the given TimeVal tv. The time contained in a TimeVal is always stored in the form of seconds elapsed since 1970-01-01 00:00:00 UTC, regardless of the local time offset.

this
this(TimeZone tz, int year, int month, int day, int hour, int minute, double seconds)

Creates a new #GDateTime corresponding to the given date and time in the time zone @tz.

this
this(string text, TimeZone defaultTz)

Creates a #GDateTime corresponding to the given ISO 8601 formatted string

@text. ISO 8601 strings of the form <date><sep><time><tz> are supported, with some extensions from RFC 3339 as mentioned below.

this
this(TimeZone tz)

Creates a #GDateTime corresponding to this exact instant in the given time zone @tz. The time is as accurate as the system allows, to a maximum accuracy of 1 microsecond.

Destructor

~this
~this()
Undocumented in source.

Members

Aliases

doref
alias doref = ref_
Undocumented in source.

Functions

add
DateTime add(GTimeSpan timespan)

Creates a copy of @datetime and adds the specified timespan to the copy.

addDays
DateTime addDays(int days)

Creates a copy of @datetime and adds the specified number of days to the copy. Add negative values to subtract days.

addFull
DateTime addFull(int years, int months, int days, int hours, int minutes, double seconds)

Creates a new #GDateTime adding the specified values to the current date and time in @datetime. Add negative values to subtract.

addHours
DateTime addHours(int hours)

Creates a copy of @datetime and adds the specified number of hours. Add negative values to subtract hours.

addMinutes
DateTime addMinutes(int minutes)

Creates a copy of @datetime adding the specified number of minutes. Add negative values to subtract minutes.

addMonths
DateTime addMonths(int months)

Creates a copy of @datetime and adds the specified number of months to the copy. Add negative values to subtract months.

addSeconds
DateTime addSeconds(double seconds)

Creates a copy of @datetime and adds the specified number of seconds. Add negative values to subtract seconds.

addWeeks
DateTime addWeeks(int weeks)

Creates a copy of @datetime and adds the specified number of weeks to the copy. Add negative values to subtract weeks.

addYears
DateTime addYears(int years)

Creates a copy of @datetime and adds the specified number of years to the copy. Add negative values to subtract years.

compare
int compare(DateTime dt2)

A comparison function for #GDateTimes that is suitable as a #GCompareFunc. Both #GDateTimes must be non-%NULL.

difference
GTimeSpan difference(DateTime begin)

Calculates the difference in time between @end and @begin. The #GTimeSpan that is returned is effectively @end - @begin (ie: positive if the first parameter is larger).

equal
bool equal(DateTime dt2)

Checks to see if @dt1 and @dt2 are equal.

format
string format(string format)

Creates a newly allocated string representing the requested @format.

formatIso8601
string formatIso8601()

Format @datetime in ISO 8601 format, including the date, time and time zone, and return that as a UTF-8 encoded string.

getDateTimeStruct
GDateTime* getDateTimeStruct(bool transferOwnership)

Get the main Gtk struct

getDayOfMonth
int getDayOfMonth()

Retrieves the day of the month represented by @datetime in the gregorian calendar.

getDayOfWeek
int getDayOfWeek()

Retrieves the ISO 8601 day of the week on which @datetime falls (1 is Monday, 2 is Tuesday... 7 is Sunday).

getDayOfYear
int getDayOfYear()

Retrieves the day of the year represented by @datetime in the Gregorian calendar.

getHour
int getHour()

Retrieves the hour of the day represented by @datetime

getMicrosecond
int getMicrosecond()

Retrieves the microsecond of the date represented by @datetime

getMinute
int getMinute()

Retrieves the minute of the hour represented by @datetime

getMonth
int getMonth()

Retrieves the month of the year represented by @datetime in the Gregorian calendar.

getSecond
int getSecond()

Retrieves the second of the minute represented by @datetime

getSeconds
double getSeconds()

Retrieves the number of seconds since the start of the last minute, including the fractional part.

getStruct
void* getStruct()

the main Gtk struct as a void*

getTimezone
TimeZone getTimezone()

Get the time zone for this @datetime.

getTimezoneAbbreviation
string getTimezoneAbbreviation()

Determines the time zone abbreviation to be used at the time and in the time zone of @datetime.

getUtcOffset
GTimeSpan getUtcOffset()

Determines the offset to UTC in effect at the time and in the time zone of @datetime.

getWeekNumberingYear
int getWeekNumberingYear()

Returns the ISO 8601 week-numbering year in which the week containing @datetime falls.

getWeekOfYear
int getWeekOfYear()

Returns the ISO 8601 week number for the week containing @datetime. 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).

getYear
int getYear()

Retrieves the year represented by @datetime in the Gregorian calendar.

getYmd
void getYmd(int year, int month, int day)

Retrieves the Gregorian day, month, and year of a given #GDateTime.

hash
uint hash()

Hashes datetime into a guint, suitable for use within GHashTable. Since 2.26

isDaylightSavings
bool isDaylightSavings()

Determines if daylight savings time is in effect at the time and in the time zone of @datetime.

opCmp
int opCmp(Object rhs)
opEquals
bool opEquals(Object rhs)
ref_
DateTime ref_()

Atomically increments the reference count of @datetime by one.

toHash
hash_t toHash()
toLocal
DateTime toLocal()

Creates a new #GDateTime corresponding to the same instant in time as @datetime, but in the local time zone.

toTimeval
bool toTimeval(TimeVal tv)

Stores the instant in time that @datetime represents into @tv.

toTimezone
DateTime toTimezone(TimeZone tz)

Create a new #GDateTime corresponding to the same instant in time as @datetime, but in the time zone @tz.

toUnix
long toUnix()

Gives the Unix time corresponding to @datetime, rounding down to the nearest second.

toUtc
DateTime toUtc()

Creates a new #GDateTime corresponding to the same instant in time as @datetime, but in UTC.

unref
void unref()

Atomically decrements the reference count of @datetime by one.

Variables

gDateTime
GDateTime* gDateTime;

the main Gtk struct

ownedRef
bool ownedRef;
Undocumented in source.

Meta

Since

2.26