#[repr(C)]pub struct QDateTime { /* private fields */ }
Expand description
The QDateTime class provides date and time functions.
Implementations§
Source§impl QDateTime
impl QDateTime
Sourcepub fn add_months(&self, nmonths: i32) -> QDateTime
pub fn add_months(&self, nmonths: i32) -> QDateTime
Returns a QDateTime object containing a datetime nmonths months later than the datetime of this object (or earlier if nmonths is negative).
Source§impl QDateTime
impl QDateTime
Sourcepub fn is_daylight_time(&self) -> bool
pub fn is_daylight_time(&self) -> bool
Returns if this datetime falls in Daylight-Saving Time.
Source§impl QDateTime
impl QDateTime
Sourcepub fn offset_from_utc(&self) -> i32
pub fn offset_from_utc(&self) -> i32
Returns this date-time’s Offset From UTC in seconds.
Source§impl QDateTime
impl QDateTime
Sourcepub fn set_offset_from_utc(&mut self, offset_seconds: i32)
pub fn set_offset_from_utc(&mut self, offset_seconds: i32)
Sets the timeSpec() to Qt::OffsetFromUTC and the offset to offsetSeconds.
Note this method is only available with Qt < 6.8
Source§impl QDateTime
impl QDateTime
Sourcepub fn set_time_spec(&mut self, spec: TimeSpec)
pub fn set_time_spec(&mut self, spec: TimeSpec)
Sets the time specification used in this datetime to spec. The datetime will refer to a different point in time.
Note this method is only available with Qt < 6.8
Source§impl QDateTime
impl QDateTime
Sourcepub fn time_zone_abbreviation(&self) -> QString
pub fn time_zone_abbreviation(&self) -> QString
Returns the Time Zone Abbreviation for this datetime.
Source§impl QDateTime
impl QDateTime
Sourcepub fn to_local_time(&self) -> QDateTime
pub fn to_local_time(&self) -> QDateTime
Returns a datetime containing the date and time information in this datetime, but specified using the Qt::LocalTime definition.
Source§impl QDateTime
impl QDateTime
Sourcepub fn to_offset_from_utc(&self, offset_seconds: i32) -> QDateTime
pub fn to_offset_from_utc(&self, offset_seconds: i32) -> QDateTime
Returns a copy of this datetime converted to a spec of Qt::OffsetFromUTC with the given offsetSeconds.
Source§impl QDateTime
impl QDateTime
Sourcepub fn to_time_spec(&self, spec: TimeSpec) -> QDateTime
pub fn to_time_spec(&self, spec: TimeSpec) -> QDateTime
Returns a copy of this datetime converted to the given time spec.
Note this method is only available with Qt < 6.8
Source§impl QDateTime
impl QDateTime
Sourcepub fn to_time_zone(&self, timeZone: &QTimeZone) -> QDateTime
pub fn to_time_zone(&self, timeZone: &QTimeZone) -> QDateTime
Returns a copy of this datetime converted to the given timeZone
Source§impl QDateTime
impl QDateTime
Sourcepub fn set_time_zone(&mut self, time_zone: &QTimeZone)
pub fn set_time_zone(&mut self, time_zone: &QTimeZone)
Sets the time zone used in this datetime to toZone. The datetime will refer to a different point in time.
Sourcepub fn add_days(&self, ndays: i64) -> Self
pub fn add_days(&self, ndays: i64) -> Self
Returns a QDateTime object containing a datetime ndays days later than the datetime of this object (or earlier if ndays is negative).
Sourcepub fn add_msecs(&self, msecs: i64) -> Self
pub fn add_msecs(&self, msecs: i64) -> Self
Returns a QDateTime object containing a datetime msecs milliseconds later than the datetime of this object (or earlier if msecs is negative).
Sourcepub fn add_secs(&self, secs: i64) -> Self
pub fn add_secs(&self, secs: i64) -> Self
Returns a QDateTime object containing a datetime s seconds later than the datetime of this object (or earlier if s is negative).
Sourcepub fn current_date_time() -> Self
pub fn current_date_time() -> Self
Returns the current datetime, as reported by the system clock, in the local time zone.
Sourcepub fn current_date_time_utc() -> Self
pub fn current_date_time_utc() -> Self
Returns the current datetime, as reported by the system clock, in UTC.
Sourcepub fn current_msecs_since_epoch() -> i64
pub fn current_msecs_since_epoch() -> i64
Returns the number of milliseconds since 1970-01-01T00:00:00 Universal Coordinated Time. This number is like the POSIX time_t variable, but expressed in milliseconds instead.
Sourcepub fn current_secs_since_epoch() -> i64
pub fn current_secs_since_epoch() -> i64
Returns the number of seconds since 1970-01-01T00:00:00 Universal Coordinated Time.
Sourcepub fn days_to(&self, other: &Self) -> i64
pub fn days_to(&self, other: &Self) -> i64
Returns the number of days from this datetime to the other datetime. The number of days is counted as the number of times midnight is reached between this datetime to the other datetime. This means that a 10 minute difference from 23:55 to 0:05 the next day counts as one day.
Sourcepub fn from_date_and_time_time_zone(
date: &QDate,
time: &QTime,
time_zone: &QTimeZone,
) -> Self
pub fn from_date_and_time_time_zone( date: &QDate, time: &QTime, time_zone: &QTimeZone, ) -> Self
Construct a Rust QDateTime from a given QDate, QTime, and QTimeZone
Sourcepub fn from_date_and_time_time_spec(
date: &QDate,
time: &QTime,
time_spec: TimeSpec,
offset_seconds: i32,
) -> Self
pub fn from_date_and_time_time_spec( date: &QDate, time: &QTime, time_spec: TimeSpec, offset_seconds: i32, ) -> Self
Construct a Rust QDateTime from a given QDate, QTime, Qt::TimeSpec, and offset
Note this method is only available with Qt < 6.8
Sourcepub fn from_msecs_since_epoch(msecs: i64, time_zone: &QTimeZone) -> Self
pub fn from_msecs_since_epoch(msecs: i64, time_zone: &QTimeZone) -> Self
Returns a datetime whose date and time are the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC) and with the given timeZone.
Sourcepub fn from_secs_since_epoch(secs: i64, time_zone: &QTimeZone) -> Self
pub fn from_secs_since_epoch(secs: i64, time_zone: &QTimeZone) -> Self
Returns a datetime whose date and time are the number of seconds secs that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC) and converted to the given spec.
Sourcepub fn msecs_to(&self, other: &Self) -> i64
pub fn msecs_to(&self, other: &Self) -> i64
Returns the number of milliseconds from this datetime to the other datetime. If the other datetime is earlier than this datetime, the value returned is negative.
Sourcepub fn secs_to(&self, other: &Self) -> i64
pub fn secs_to(&self, other: &Self) -> i64
Returns the number of seconds from this datetime to the other datetime. If the other datetime is earlier than this datetime, the value returned is negative.
Sourcepub fn set_date(&mut self, date: QDate)
pub fn set_date(&mut self, date: QDate)
Sets the date part of this datetime to date. If no time is set yet, it is set to midnight. If date is invalid, this QDateTime becomes invalid.
Sourcepub fn set_msecs_since_epoch(&mut self, msecs: i64)
pub fn set_msecs_since_epoch(&mut self, msecs: i64)
Sets the date and time given the number of milliseconds msecs that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC.
Sourcepub fn set_secs_since_epoch(&mut self, secs: i64)
pub fn set_secs_since_epoch(&mut self, secs: i64)
Sets the date and time given the number of seconds secs that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC). On systems that do not support time zones this function will behave as if local time were Qt::UTC.
Sourcepub fn set_time(&mut self, time: QTime)
pub fn set_time(&mut self, time: QTime)
Sets the time part of this datetime to time. If time is not valid, this function sets it to midnight. Therefore, it’s possible to clear any set time in a QDateTime by setting it to a default QTime.
Sourcepub fn to_msecs_since_epoch(&self) -> i64
pub fn to_msecs_since_epoch(&self) -> i64
Returns the datetime as the number of milliseconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).
Sourcepub fn to_secs_since_epoch(&self) -> i64
pub fn to_secs_since_epoch(&self) -> i64
Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time (Qt::UTC).