pub struct QDate { /* private fields */ }
Expand description
The QDate class provides date functions.
Implementations§
Source§impl QDate
impl QDate
Sourcepub fn add_months(&self, nmonths: i32) -> QDate
pub fn add_months(&self, nmonths: i32) -> QDate
Returns a QDate object containing a date nmonths later than the date of this object (or earlier if nmonths is negative).
Sourcepub fn add_years(&self, nyears: i32) -> QDate
pub fn add_years(&self, nyears: i32) -> QDate
Returns a QDate object containing a date nyears later than the date of this object (or earlier if nyears is negative).
Sourcepub fn day_of_week(&self) -> i32
pub fn day_of_week(&self) -> i32
Returns the weekday (1 = Monday to 7 = Sunday) for this date.
Sourcepub fn day_of_year(&self) -> i32
pub fn day_of_year(&self) -> i32
Returns the day of the year (1 for the first day) for this date.
Sourcepub fn days_in_monyth(&self) -> i32
pub fn days_in_monyth(&self) -> i32
Returns the number of days in the month for this date.
Sourcepub fn days_in_year(&self) -> i32
pub fn days_in_year(&self) -> i32
Returns the number of days in the year for this date.
Sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
Returns true if the date is null; otherwise returns false. A null date is invalid.
Sourcepub fn month(&self) -> i32
pub fn month(&self) -> i32
Returns the month-number for the date.
Numbers the months of the year starting with 1 for the first
Sourcepub fn set_date(&mut self, y: i32, m: i32, d: i32) -> bool
pub fn set_date(&mut self, y: i32, m: i32, d: i32) -> bool
Sets this to represent the date, in the Gregorian calendar, with the given year, month and day numbers. Returns true if the resulting date is valid, otherwise it sets this to represent an invalid date and returns false.
Sourcepub fn format_enum(&self, format: DateFormat) -> QString
pub fn format_enum(&self, format: DateFormat) -> QString
Returns the time as a string. The format parameter determines the format of the string.
Source§impl QDate
impl QDate
Sourcepub fn add_days(&self, ndays: i64) -> Self
pub fn add_days(&self, ndays: i64) -> Self
Returns a QDate object containing a date ndays later than the date of this object (or earlier if ndays is negative).
Returns a null date if the current date is invalid or the new date is out of range.
pub fn current_date() -> Self
Sourcepub fn days_to(&self, date: Self) -> i64
pub fn days_to(&self, date: Self) -> i64
Returns the number of days from this date to d (which is negative if d is earlier than this date).
Returns 0 if either date is invalid.
Sourcepub fn format(&self, format: &QString) -> QString
pub fn format(&self, format: &QString) -> QString
Returns the time as a string. The format parameter determines the format of the result string.
Sourcepub fn from_julian_day(jd: i64) -> Self
pub fn from_julian_day(jd: i64) -> Self
Converts the Julian day jd to a QDate.
Sourcepub fn from_string(string: &QString, format: &QString) -> Option<Self>
pub fn from_string(string: &QString, format: &QString) -> Option<Self>
Returns the QTime represented by the string, using the format given, or None if the string cannot be parsed.
Sourcepub fn from_string_enum(string: &QString, format: DateFormat) -> Option<Self>
pub fn from_string_enum(string: &QString, format: DateFormat) -> Option<Self>
Returns the time represented in the string as a QTime using the format given, or None if this is not possible.
Sourcepub fn is_leap_year(year: i32) -> bool
pub fn is_leap_year(year: i32) -> bool
Returns true if the specified year is a leap year in the Gregorian calendar; otherwise returns false.
Sourcepub fn to_julian_day(&self) -> i64
pub fn to_julian_day(&self) -> i64
Converts the date to a Julian day.