QLocale can map the day numbers to names, QCalendar can map month numbers to names. The same information is provided in textual format by toString(). When more than one of these values is needed, it is more efficient to call QCalendar::partsFromDate(), to save repeating (potentially expensive) calendrical calculations.Īlso, dayOfWeek() and dayOfYear() functions are provided. The year(), month(), and day() functions provide access to the year, month, and day numbers. The fromString() function returns a QDate given a string and a date format which is used to interpret the date within the string. An explicit date can also be set using setDate(). The static function currentDate() creates a QDate object containing the date read from the system clock. Note that QDate interprets year numbers less than 100 as presented, i.e., as years 1 through 99, without adding any offset. QDate objects should be passed by value rather than by reference to const they simply package qint64.Ī QDate object is typically created by giving the year, month, and day numbers explicitly. It can report the year, month and day of the month that represent the day with respect to the proleptic Gregorian calendar or any calendar supplied as a QCalendar object. WeekNumber(int * yearNumber = nullptr) constĪ QDate object represents a particular day, regardless of calendar, locale or other settings used when creating it or supplied by the system. ToString(QStringView format, QCalendar cal = QCalendar()) const ToString(Qt::DateFormat format = Qt::TextDate) const ToString(const QString & format, QCalendar cal = QCalendar()) const SetDate(int year, int month, int day, QCalendar cal) GetDate(int * year, int * month, int * day) const QDate(std::chrono::year_month_weekday_last ymd)ĪddDuration(std::chrono::days ndays) constĪddMonths(int nmonths, QCalendar cal) constĪddYears(int nyears, QCalendar cal) const QDate(std::chrono::year_month_weekday ymd) QDate(std::chrono::year_month_day_last ymd)
0 Comments
Leave a Reply. |