KCalendarSystem Class Reference
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE. More...
#include <kcalendarsystem.h>

Public Types | |
| enum | MonthNameFormat { ShortName, LongName, ShortNamePossessive, LongNamePossessive } |
| enum | StringFormat { ShortFormat, LongFormat } |
| enum | WeekDayNameFormat { ShortDayName, LongDayName } |
Public Member Functions | |
| KCalendarSystem (const KLocale *locale=0) | |
| KCalendarSystem (const KSharedConfig::Ptr config, const KLocale *locale=0) | |
| virtual | ~KCalendarSystem () |
| virtual QDate | addDays (const QDate &date, int ndays) const |
| virtual QDate | addMonths (const QDate &date, int nmonths) const |
| virtual QDate | addYears (const QDate &date, int nyears) const |
| int | applyShortYearWindow (int inputYear) const |
| QString | calendarLabel () const |
| KLocale::CalendarSystem | calendarSystem () const |
| virtual QString | calendarType () const =0 |
| void | dateDifference (const QDate &fromDate, const QDate &toDate, int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const |
| virtual int | day (const QDate &date) const |
| virtual int | dayOfWeek (const QDate &date) const |
| QString | dayOfWeekString (const QDate &pDate) const |
| virtual int | dayOfYear (const QDate &date) const |
| QString | dayOfYearString (const QDate &pDate, StringFormat format=LongFormat) const |
| int | daysDifference (const QDate &fromDate, const QDate &toDate) const |
| int | daysInMonth (int year, int month) const |
| virtual int | daysInMonth (const QDate &date) const |
| QString | daysInMonthString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual int | daysInWeek (const QDate &date) const |
| QString | daysInWeekString (const QDate &date) const |
| virtual int | daysInYear (const QDate &date) const |
| int | daysInYear (int year) const |
| QString | daysInYearString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual QString | dayString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual int | dayStringToInteger (const QString &sNum, int &iLength) const |
| virtual QDate | earliestValidDate () const |
| virtual QDate | epoch () const |
| QString | eraName (const QDate &date, StringFormat format=ShortFormat) const |
| QString | eraYear (const QDate &date, StringFormat format=ShortFormat) const |
| QDate | firstDayOfMonth (int year, int month) const |
| QDate | firstDayOfMonth (const QDate &date=QDate::currentDate()) const |
| QDate | firstDayOfYear (int year) const |
| QDate | firstDayOfYear (const QDate &date=QDate::currentDate()) const |
| QString | formatDate (const QDate &fromDate, const QString &toFormat, KLocale::DigitSet digitSet, KLocale::DateTimeFormatStandard formatStandard=KLocale::KdeFormat) const |
| virtual QString | formatDate (const QDate &fromDate, KLocale::DateFormat toFormat=KLocale::LongDate) const |
| QString | formatDate (const QDate &fromDate, const QString &toFormat, KLocale::DateTimeFormatStandard formatStandard=KLocale::KdeFormat) const |
| QString | formatDate (const QDate &date, KLocale::DateTimeComponent component, KLocale::DateTimeComponentFormat format=KLocale::DefaultComponentFormat, KLocale::WeekNumberSystem weekNumberSystem=KLocale::DefaultWeekNumber) const |
| void | getDate (const QDate date, int *year, int *month, int *day) const |
| virtual bool | isLeapYear (int year) const =0 |
| virtual bool | isLeapYear (const QDate &date) const |
| virtual bool | isLunar () const =0 |
| virtual bool | isLunisolar () const =0 |
| virtual bool | isProleptic () const =0 |
| virtual bool | isSolar () const =0 |
| virtual bool | isValid (int year, int month, int day) const =0 |
| bool | isValid (int year, int dayOfYear) const |
| bool | isValid (const QString &eraName, int yearInEra, int month, int day) const |
| virtual bool | isValid (const QDate &date) const |
| bool | isValidIsoWeekDate (int year, int isoWeekNumber, int dayOfIsoWeek) const |
| QDate | lastDayOfMonth (int year, int month) const |
| QDate | lastDayOfMonth (const QDate &date=QDate::currentDate()) const |
| QDate | lastDayOfYear (int year) const |
| QDate | lastDayOfYear (const QDate &date=QDate::currentDate()) const |
| virtual QDate | latestValidDate () const |
| virtual int | month (const QDate &date) const |
| virtual QString | monthName (const QDate &date, MonthNameFormat format=LongName) const |
| virtual QString | monthName (int month, int year, MonthNameFormat format=LongName) const =0 |
| int | monthsDifference (const QDate &fromDate, const QDate &toDate) const |
| virtual int | monthsInYear (const QDate &date) const |
| int | monthsInYear (int year) const |
| QString | monthsInYearString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual QString | monthString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual int | monthStringToInteger (const QString &sNum, int &iLength) const |
| virtual QDate | readDate (const QString &str, bool *ok=0) const |
| virtual QDate | readDate (const QString &str, KLocale::ReadDateFlags flags, bool *ok=0) const |
| QDate | readDate (const QString &dateString, const QString &dateFormat, bool *ok, KLocale::DateTimeFormatStandard formatStandard) const |
| virtual QDate | readDate (const QString &dateString, const QString &dateFormat, bool *ok=0) const |
| bool | setDate (QDate &date, QString eraName, int yearInEra, int month, int day) const |
| bool | setDate (QDate &date, int year, int dayOfYear) const |
| virtual bool | setDate (QDate &date, int year, int month, int day) const |
| bool | setDateIsoWeek (QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek) const |
| virtual bool | setYMD (QDate &date, int y, int m, int d) const |
| int | shortYearWindowStartYear () const |
| virtual QString | weekDayName (int weekDay, WeekDayNameFormat format=LongDayName) const =0 |
| virtual QString | weekDayName (const QDate &date, WeekDayNameFormat format=LongDayName) const |
| virtual int | weekDayOfPray () const =0 |
| virtual int | weekNumber (const QDate &date, int *yearNum=0) const |
| QString | weekNumberString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual int | weeksInYear (int year) const |
| virtual int | weeksInYear (const QDate &date) const |
| QString | weeksInYearString (const QDate &pDate, StringFormat format=LongFormat) const |
| virtual int | weekStartDay () const |
| virtual int | year (const QDate &date) const |
| int | yearInEra (const QDate &date) const |
| QString | yearInEraString (const QDate &date, StringFormat format=ShortFormat) const |
| int | yearsDifference (const QDate &fromDate, const QDate &toDate) const |
| virtual QString | yearString (const QDate &date, StringFormat format=LongFormat) const |
| virtual int | yearStringToInteger (const QString &sNum, int &iLength) const |
Static Public Member Functions | |
| static QString | calendarLabel (const QString &calendarType) |
| static QString | calendarLabel (KLocale::CalendarSystem calendarSystem, const KLocale *locale=KGlobal::locale()) |
| static KLocale::CalendarSystem | calendarSystemForCalendarType (const QString &calendarType) |
| static QStringList | calendarSystems () |
| static QList < KLocale::CalendarSystem > | calendarSystemsList () |
| static KCalendarSystem * | create (const QString &calType, KSharedConfig::Ptr config, const KLocale *locale=0) |
| static KCalendarSystem * | create (const QString &calType=QLatin1String("gregorian"), const KLocale *locale=0) |
| static KCalendarSystem * | create (KLocale::CalendarSystem calendarSystem, const KLocale *locale=0) |
| static KCalendarSystem * | create (KLocale::CalendarSystem calendarSystem, KSharedConfig::Ptr config, const KLocale *locale=0) |
Protected Member Functions | |
| KCalendarSystem (KCalendarSystemPrivate &dd, const KSharedConfig::Ptr config=KSharedConfig::Ptr(), const KLocale *locale=0) | |
| virtual bool | dateToJulianDay (int year, int month, int day, int &jd) const =0 |
| virtual bool | julianDayToDate (int jd, int &year, int &month, int &day) const =0 |
| const KLocale * | locale () const |
| void | setHasYear0 (bool hasYear0) |
| void | setMaxDaysInWeek (int maxDays) |
| void | setMaxMonthsInYear (int maxMonths) |
Detailed Description
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE.
Derived classes must be created through the create() static method
Definition at line 40 of file kcalendarsystem.h.
Member Enumeration Documentation
Format for returned month / day name.
- Enumerator:
Definition at line 55 of file kcalendarsystem.h.
Format for returned year number / month number / day number as string.
- Enumerator:
ShortFormat Short string format, e.g.
2000 = "00" or 6 = "6"
LongFormat Long string format, e.g.
2000 = "2000" or 6 = "06"
Definition at line 47 of file kcalendarsystem.h.
Format for returned month / day name.
Definition at line 65 of file kcalendarsystem.h.
Constructor & Destructor Documentation
| KCalendarSystem::KCalendarSystem | ( | const KLocale * | locale = 0 | ) | [explicit] |
Constructor of abstract calendar class.
This will be called by derived classes.
- Parameters:
-
locale locale to use for translations. The global locale is used if null.
Definition at line 838 of file kcalendarsystem.cpp.
| KCalendarSystem::KCalendarSystem | ( | const KSharedConfig::Ptr | config, |
| const KLocale * | locale = 0 |
||
| ) | [explicit] |
Constructor of abstract calendar class.
This will be called by derived classes.
- Parameters:
-
config a configuration file with a 'KCalendarSystem calendarName' group detailing locale-related preferences (such as era options). The global config is used if null. locale locale to use for translations. The global locale is used if null.
Definition at line 845 of file kcalendarsystem.cpp.
| KCalendarSystem::~KCalendarSystem | ( | ) | [virtual] |
Destructor.
Definition at line 859 of file kcalendarsystem.cpp.
| KCalendarSystem::KCalendarSystem | ( | KCalendarSystemPrivate & | dd, |
| const KSharedConfig::Ptr | config = KSharedConfig::Ptr(), |
||
| const KLocale * | locale = 0 |
||
| ) | [protected] |
Constructor of abstract calendar class.
This will be called by derived classes.
- Parameters:
-
dd derived private d-pointer. config a configuration file with a 'KCalendarSystem calendarName' group detailing locale-related preferences (such as era options). The global config is used if null. locale locale to use for translations. The global locale is used if null.
Definition at line 852 of file kcalendarsystem.cpp.
Member Function Documentation
| QDate KCalendarSystem::addDays | ( | const QDate & | date, |
| int | ndays | ||
| ) | const [virtual] |
Returns a QDate containing a date ndays days later.
- Parameters:
-
date The old date ndays number of days to add
- Returns:
- The new date, null date if any errors
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1267 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::addMonths | ( | const QDate & | date, |
| int | nmonths | ||
| ) | const [virtual] |
Returns a QDate containing a date nmonths months later.
- Parameters:
-
date The old date nmonths number of months to add
- Returns:
- The new date, null date if any errors
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1228 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::addYears | ( | const QDate & | date, |
| int | nyears | ||
| ) | const [virtual] |
Returns a QDate containing a date nyears years later.
- Parameters:
-
date The old date nyears The number of years to add
- Returns:
- The new date, null date if any errors
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1200 of file kcalendarsystem.cpp.
| int KCalendarSystem::applyShortYearWindow | ( | int | inputYear | ) | const |
- Since:
- 4.6
Returns the Year Number after applying the Year Window.
If the inputYear is between 0 and 99, then apply the Year Window and return the calculated Year Number.
If the inputYear is not between 0 and 99, then the original Year Number is returned.
- See also:
- KLocale::setYearWindowOffset
- KLocale::yearWindowOffset
- Parameters:
-
inputYear the year number to apply the year window to
- Returns:
- the year number after applying the year window
Definition at line 2161 of file kcalendarsystem.cpp.
- Deprecated:
- use calendarLabel( KLocale::CalendarSystem ) instead
Returns a typographically correct and translated label to display for the calendar system type. Use with calendarSystems() to neatly format labels to display on combo widget of available calendar systems.
- Parameters:
-
calendarType the specific calendar type to return the label for
- Returns:
- label for calendar
Definition at line 78 of file kcalendarsystem.cpp.
| QString KCalendarSystem::calendarLabel | ( | KLocale::CalendarSystem | calendarSystem, |
| const KLocale * | locale = KGlobal::locale() |
||
| ) | [static] |
- Since:
- 4.6
Returns a localized label to display for the required Calendar System type.
Use with calendarSystemsList() to populate selction lists of available calendar systems.
- Parameters:
-
calendarType the specific calendar type to return the label for locale the locale to use for the label, defaults to global
- Returns:
- label for calendar
Definition at line 145 of file kcalendarsystem.cpp.
| QString KCalendarSystem::calendarLabel | ( | ) | const |
- Since:
- 4.6
Returns a localized label to display for the current Calendar System type.
- Returns:
- localized label for this Calendar System
Definition at line 873 of file kcalendarsystem.cpp.
| KLocale::CalendarSystem KCalendarSystem::calendarSystem | ( | ) | const |
- Since:
- 4.6
Returns the Calendar System type of the KCalendarSystem object
- Returns:
- type of calendar system
Definition at line 865 of file kcalendarsystem.cpp.
| KLocale::CalendarSystem KCalendarSystem::calendarSystemForCalendarType | ( | const QString & | calendarType | ) | [static] |
- Since:
- 4.6
Returns the Calendar System enum value for a given Calendar Type, e.g. KLocale::QDateCalendar for "gregorian"
- Parameters:
-
calendarType the calendar type to convert
- Returns:
- calendar system for calendar type
Definition at line 177 of file kcalendarsystem.cpp.
| QStringList KCalendarSystem::calendarSystems | ( | ) | [static] |
- Deprecated:
- use calendarSystemsList() instead
Gets a list of names of supported calendar systems.
- Returns:
- list of names
Definition at line 58 of file kcalendarsystem.cpp.
| QList< KLocale::CalendarSystem > KCalendarSystem::calendarSystemsList | ( | ) | [static] |
- Since:
- 4.6
Returns the list of currently supported Calendar Systems
- Returns:
- list of Calendar Systems
Definition at line 125 of file kcalendarsystem.cpp.
| virtual QString KCalendarSystem::calendarType | ( | ) | const [pure virtual] |
- Deprecated:
- use calendarSystem() instead
Returns the calendar system type.
- Returns:
- type of calendar system
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| KCalendarSystem * KCalendarSystem::create | ( | KLocale::CalendarSystem | calendarSystem, |
| KSharedConfig::Ptr | config, | ||
| const KLocale * | locale = 0 |
||
| ) | [static] |
- Since:
- 4.6
Creates a KCalendarSystem object for the required Calendar System
- Parameters:
-
calendarSystem the Calendar System to create config a configuration file with a 'KCalendarSystem calendarType' group detailing locale-related preferences (such as era options). The global config is used if null. locale locale to use for translations. The global locale is used if null.
- Returns:
- a KCalendarSystem object
Definition at line 92 of file kcalendarsystem.cpp.
| KCalendarSystem * KCalendarSystem::create | ( | const QString & | calType = QLatin1String( "gregorian" ), |
| const KLocale * | locale = 0 |
||
| ) | [static] |
- Deprecated:
- use create(KLocale::CalendarSystem, KLocale) instead
Creates specific calendar type
- Parameters:
-
calType string identification of the specific calendar type to be constructed locale locale to use for translations. The global locale is used if null.
- Returns:
- a KCalendarSystem object
Definition at line 47 of file kcalendarsystem.cpp.
| KCalendarSystem * KCalendarSystem::create | ( | const QString & | calType, |
| KSharedConfig::Ptr | config, | ||
| const KLocale * | locale = 0 |
||
| ) | [static] |
- Deprecated:
- use create(KLocale::CalendarSystem, KSharedConfig, KLocale) instead
- Since:
- 4.5
Creates specific calendar type
- Parameters:
-
calType string identification of the specific calendar type to be constructed config a configuration file with a 'KCalendarSystem calendarType' group detailing locale-related preferences (such as era options). The global config is used if null. locale locale to use for translations. The global locale is used if null.
- Returns:
- a KCalendarSystem object
Definition at line 52 of file kcalendarsystem.cpp.
| KCalendarSystem * KCalendarSystem::create | ( | KLocale::CalendarSystem | calendarSystem, |
| const KLocale * | locale = 0 |
||
| ) | [static] |
- Since:
- 4.6
Creates a KCalendarSystem object for the required Calendar System
- Parameters:
-
calendarSystem the Calendar System to create, defaults to QDate compatible locale locale to use for translations. The global locale is used if null.
- Returns:
- a KCalendarSystem object
Definition at line 87 of file kcalendarsystem.cpp.
| void KCalendarSystem::dateDifference | ( | const QDate & | fromDate, |
| const QDate & | toDate, | ||
| int * | yearsDiff, | ||
| int * | monthsDiff, | ||
| int * | daysDiff, | ||
| int * | direction | ||
| ) | const |
Returns the difference between two dates in years, months and days.
The difference is always caculated from the earlier date to the later date in year, month and day order, with the direction parameter indicating which direction the difference is applied from the toDate.
For example, the difference between 2010-06-10 and 2012-09-5 is 2 years, 2 months and 26 days. Note that the difference between two last days of the month is always 1 month, e.g. 2010-01-31 to 2010-02-28 is 1 month not 28 days.
- Parameters:
-
fromDate The date to start from toDate The date to end at yearsDiff Returns number of years difference monthsDiff Returns number of months difference daysDiff Returns number of days difference direction Returns direction of difference, 1 if fromDate <= toDate, -1 otherwise
Definition at line 1284 of file kcalendarsystem.cpp.
| bool KCalendarSystem::dateToJulianDay | ( | int | year, |
| int | month, | ||
| int | day, | ||
| int & | jd | ||
| ) | const [protected, pure virtual] |
Internal method to convert YMD values for this calendar system into a Julian Day number.
All calendar system implementations MUST implement julianDayToDate and dateToJulianDay methods as all other methods can be expressed as functions of these. Does no internal validity checking.
- See also:
- KCalendarSystem::julianDayToDate
- Parameters:
-
year year number month month number day day of month jd Julian day number returned in this variable
- Returns:
trueif the date is valid,falseotherwise
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 2211 of file kcalendarsystem.cpp.
| int KCalendarSystem::day | ( | const QDate & | date | ) | const [virtual] |
Returns the day portion of a given date in the current calendar system.
- Parameters:
-
date date to return day for
- Returns:
- day of the month, 0 if input date is invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1122 of file kcalendarsystem.cpp.
| int KCalendarSystem::dayOfWeek | ( | const QDate & | date | ) | const [virtual] |
Returns the weekday number for the given date.
The weekdays are numbered 1..7 for Monday..Sunday.
This value is not affected by the value of weekStartDay()
- Parameters:
-
date the date to obtain day from
- Returns:
- day of week number, -1 if input date not valid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1451 of file kcalendarsystem.cpp.
| QString KCalendarSystem::dayOfWeekString | ( | const QDate & | pDate | ) | const |
- Since:
- 4.4
Converts a date into a day of week literal
- Parameters:
-
pDate The date to convert
- Returns:
- The day of week literal of the date, empty string if any error
- See also:
- dayOfWeek()
Definition at line 1712 of file kcalendarsystem.cpp.
| int KCalendarSystem::dayOfYear | ( | const QDate & | date | ) | const [virtual] |
Returns the day number of year for the given date.
The days are numbered 1..daysInYear()
- Parameters:
-
date the date to obtain day from
- Returns:
- day of year number, -1 if input date not valid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1439 of file kcalendarsystem.cpp.
| QString KCalendarSystem::dayOfYearString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const |
- Since:
- 4.4
Converts a date into a day of year literal
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The day of year literal of the date, empty string if any error
- See also:
- dayOfYear()
Definition at line 1702 of file kcalendarsystem.cpp.
| int KCalendarSystem::daysDifference | ( | const QDate & | fromDate, |
| const QDate & | toDate | ||
| ) | const |
Returns the difference between two dates in days The returned value will be negative if fromDate > toDate.
- Parameters:
-
fromDate The date to start from toDate The date to end at
- Returns:
- The number of days difference
Definition at line 1319 of file kcalendarsystem.cpp.
| int KCalendarSystem::daysInMonth | ( | const QDate & | date | ) | const [virtual] |
Returns the number of days in the given month.
- Parameters:
-
date the date to obtain month from
- Returns:
- number of days in month, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1407 of file kcalendarsystem.cpp.
| int KCalendarSystem::daysInMonth | ( | int | year, |
| int | month | ||
| ) | const |
- Since:
- 4.5
Returns the number of days in the given month.
- Parameters:
-
year the year the month is in month the month
- Returns:
- number of days in month, -1 if input date invalid
Definition at line 1421 of file kcalendarsystem.cpp.
| QString KCalendarSystem::daysInMonthString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const |
- Since:
- 4.4
Returns the days in month for a date as a numeric string
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The days in month literal of the date, empty string if any error
- See also:
- daysInMonth()
Definition at line 1764 of file kcalendarsystem.cpp.
| int KCalendarSystem::daysInWeek | ( | const QDate & | date | ) | const [virtual] |
Returns the number of days in the given week.
- Parameters:
-
date the date to obtain week from
- Returns:
- number of days in week, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1432 of file kcalendarsystem.cpp.
| QString KCalendarSystem::daysInWeekString | ( | const QDate & | date | ) | const |
- Since:
- 4.4
Returns the days in week for a date as a numeric string
- Parameters:
-
date The date to convert
- Returns:
- The days in week literal of the date, empty string if any error
- See also:
- daysInWeek()
Definition at line 1776 of file kcalendarsystem.cpp.
| int KCalendarSystem::daysInYear | ( | const QDate & | date | ) | const [virtual] |
Returns the number of days in the given year.
- Parameters:
-
date the date to obtain year from
- Returns:
- number of days in year, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1384 of file kcalendarsystem.cpp.
| int KCalendarSystem::daysInYear | ( | int | year | ) | const |
- Since:
- 4.5
Returns the number of days in the given year.
- Parameters:
-
year the year
- Returns:
- number of days in year, -1 if input date invalid
Definition at line 1396 of file kcalendarsystem.cpp.
| QString KCalendarSystem::daysInYearString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const |
- Since:
- 4.4
Returns the days in year for a date as a numeric string
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The days in year literal of the date, empty string if any error
- See also:
- daysInYear()
Definition at line 1752 of file kcalendarsystem.cpp.
| QString KCalendarSystem::dayString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const [virtual] |
Converts a date into a day literal.
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The day literal of the date, empty string if any error
- See also:
- day()
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1682 of file kcalendarsystem.cpp.
| int KCalendarSystem::dayStringToInteger | ( | const QString & | sNum, |
| int & | iLength | ||
| ) | const [virtual] |
Converts a day literal of a part of a string into a integer starting at the beginning of the string
- Parameters:
-
sNum The string to parse iLength The number of QChars used, and 0 if no valid symbols was found in the string
- Returns:
- An integer corresponding to the day
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1807 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::earliestValidDate | ( | ) | const [virtual] |
Returns the earliest date valid in this calendar system implementation.
If the calendar system is proleptic then this may be before epoch.
- Returns:
- date the earliest valid date
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 885 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::epoch | ( | ) | const [virtual] |
Returns a QDate holding the epoch of the calendar system.
Usually YMD of 1/1/1, access the returned QDates method toJulianDay() if you require the actual Julian day number. Note: a particular calendar system implementation may not include the epoch in its supported range, or the calendar system may be proleptic in which case it supports dates before the epoch.
- See also:
- KCalendarSystem::earliestValidDate
- KCalendarSystem::latestValidDate
- KCalendarSystem::isProleptic
- KCalendarSystem::isValid
- Returns:
- epoch of calendar system
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 880 of file kcalendarsystem.cpp.
| QString KCalendarSystem::eraName | ( | const QDate & | date, |
| StringFormat | format = ShortFormat |
||
| ) | const |
- Since:
- 4.5
Returns the Era Name portion of a given date in the current calendar system, for example "AD" or "Anno Domini" for the Gregorian calendar and Christian Era.
- Parameters:
-
date date to return Era Name for format format to return, either short or long
- Returns:
- era name, empty string if input date is invalid
Definition at line 1136 of file kcalendarsystem.cpp.
| QString KCalendarSystem::eraYear | ( | const QDate & | date, |
| StringFormat | format = ShortFormat |
||
| ) | const |
- Since:
- 4.5
Returns the Era Year portion of a given date in the current calendar system, for example "2000 AD" or "Heisei 22".
- Parameters:
-
date date to return Era Year for format format to return, either short or long
- Returns:
- era name, empty string if input date is invalid
Definition at line 1152 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::firstDayOfMonth | ( | int | year, |
| int | month | ||
| ) | const |
- Since:
- 4.6
Returns a QDate containing the first day of the month
- Parameters:
-
date The month to return the date for, defaults to today
- Returns:
- The first day of the month
Definition at line 1593 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::firstDayOfMonth | ( | const QDate & | date = QDate::currentDate() | ) | const |
- Since:
- 4.6
Returns a QDate containing the first day of the month
- Parameters:
-
date The month to return the date for, defaults to today
- Returns:
- The first day of the month
Definition at line 1617 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::firstDayOfYear | ( | int | year | ) | const |
- Since:
- 4.6
Returns a QDate containing the first day of the year
- Parameters:
-
date The year to return the date for
- Returns:
- The first day of the year
Definition at line 1545 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::firstDayOfYear | ( | const QDate & | date = QDate::currentDate() | ) | const |
- Since:
- 4.6
Returns a QDate containing the first day of the year
- Parameters:
-
date The year to return the date for, defaults to today
- Returns:
- The first day of the year
Definition at line 1569 of file kcalendarsystem.cpp.
| QString KCalendarSystem::formatDate | ( | const QDate & | fromDate, |
| const QString & | toFormat, | ||
| KLocale::DigitSet | digitSet, | ||
| KLocale::DateTimeFormatStandard | formatStandard = KLocale::KdeFormat |
||
| ) | const |
- Since:
- 4.4
Returns a string formatted to the given format string and Digit Set. Only use this version if you need control over the Digit Set and do not want to use the locale Digit Set.
- See also:
- formatDate
- Parameters:
-
fromDate the date to be formatted toFormat the date format to use digitSet the Digit Set to format the date in formatStandard the standard the date format uses, defaults to KDE Standard
- Returns:
- The date as a string
Definition at line 1864 of file kcalendarsystem.cpp.
| QString KCalendarSystem::formatDate | ( | const QDate & | fromDate, |
| KLocale::DateFormat | toFormat = KLocale::LongDate |
||
| ) | const [virtual] |
Returns a string formatted to the current locale's conventions regarding dates.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::formatDate
- Parameters:
-
fromDate the date to be formatted toFormat category of date format to use
- Returns:
- The date as a string
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1813 of file kcalendarsystem.cpp.
| QString KCalendarSystem::formatDate | ( | const QDate & | fromDate, |
| const QString & | toFormat, | ||
| KLocale::DateTimeFormatStandard | formatStandard = KLocale::KdeFormat |
||
| ) | const |
- Since:
- 4.4
Returns a string formatted to the given format and localised to the correct language and digit set using the requested format standard.
*** WITH GREAT POWER COMES GREAT RESPONSIBILITY *** Please use with care and only in situations where the DateFormat enum or locale formats or individual string methods do not provide what you need. You should almost always translate your format string as documented. Using the standard DateFormat options instead would take care of the translation for you.
Warning: The n element differs from the GNU/POSIX standard where it is defined as a newline. KDE currently uses this for short day number. It is recommended for compatibility purposes to use -m instead.
The toFormat parameter is a good candidate to be made translatable, so that translators can adapt it to their language's convention. There should also be a context using the "kdedt-format" keyword (for automatic validation of translations) and stating the format's purpose:
QDate reportDate; KGlobal::locale()->calendar()->setDate(reportDate, reportYear, reportMonth, 1); dateFormat = i18nc("(kdedt-format) Report month and year in report header", "%B %Y")); dateString = KGlobal::locale()->calendar()->formatDate(reportDate, dateFormat);
The date format string can be defined using either the KDE or POSIX standards. The KDE standard closely follows the POSIX standard but with some exceptions. Always use the KDE standard within KDE, but where interaction is required with external POSIX compliant systems (e.g. Gnome, glibc, etc) the POSIX standard should be used.
Date format strings are made up of date componants and string literals. Date componants are prefixed by a % escape character and are made up of optional padding and case modifier flags, an optional width value, and a compulsary code for the actual date componant: %[Flags][Width][Componant] e.g. _^5Y No spaces are allowed.
The Flags can modify the padding character and/or case of the Date Componant. The Flags are optional and may be combined and/or repeated in any order, in which case the last Padding Flag and last Case Flag will be the ones used. The Flags must be immediately after the % and before any Width.
The Width can modify how wide the date Componant is padded to. The Width is an optional interger value and must be after any Flags but before the Componant. If the Width is less than the minimum defined for a Componant then the default minimum will be used instead.
By default most numeric Date Componants are right-aligned with leading 0's.
By default all string name fields are capital case and unpadded.
The following Flags may be specified:
- - (hyphen) no padding (e.g. 1 Jan and "%-j" = "1")
- _ (underscore) pad with spaces (e.g. 1 Jan and "%-j" = " 1")
- 0 (zero) pad with 0's (e.g. 1 Jan and "%0j" = "001")
- ^ (caret) make uppercase (e.g. 1 Jan and "%^B" = "JANUARY")
- # (hash) invert case (e.g. 1 Jan and "%#B" = "???")
The following Date Componants can be specified:
- Y the year to 4 digits (e.g. "1984" for 1984, "0584" for 584, "0084" for 84)
- C the 'century' portion of the year to 2 digits (e.g. "19" for 1984, "05" for 584, "00" for 84)
- y the lower 2 digits of the year to 2 digits (e.g. "84" for 1984, "05" for 2005)
- EY the full local era year (e.g. "2000 AD")
- EC the era name short form (e.g. "AD")
- Ey the year in era to 1 digit (e.g. 1 or 2000)
- m the month number to 2 digits (January="01", December="12")
- n the month number to 1 digit (January="1", December="12"), see notes!
- d the day number of the month to 2 digits (e.g. "01" on the first of March)
- e the day number of the month to 1 digit (e.g. "1" on the first of March)
- B the month name long form (e.g. "January")
- b the month name short form (e.g. "Jan" for January)
- h the month name short form (e.g. "Jan" for January)
- A the weekday name long form (e.g. "Wednesday" for Wednesday)
- a the weekday name short form (e.g. "Wed" for Wednesday)
- j the day of the year number to 3 digits (e.g. "001" for 1 Jan)
- V the ISO week of the year number to 2 digits (e.g. "01" for ISO Week 1)
- G the year number in long form of the ISO week of the year to 4 digits (e.g. "2004" for 1 Jan 2005)
- g the year number in short form of the ISO week of the year to 2 digits (e.g. "04" for 1 Jan 2005)
- u the day of the week number to 1 digit (e.g. "1" for Monday)
- D the US short date format (e.g. "%m/%d/%y")
- F the ISO short date format (e.g. "%Y-%m-%d")
- x the KDE locale short date format
- %% the literal "%"
- t a tab character
Everything else in the format string will be taken as literal text.
Examples: "%Y-%m-%d" = "2009-01-01" "%Y-%-m-%_4d" = "2009-1- 1"
The following format codes behave differently in the KDE and POSIX standards
- e in GNU/POSIX is space padded to 2 digits, in KDE is not padded
- n in GNU/POSIX is newline, in KDE is short month number
The following POSIX format codes are currently not supported:
- U US week number
- w US day of week
- W US week number
- O locale's alternative numeric symbols, in KDE is not supported
0 is not supported as the returned result is always in the locale's chosen numeric symbol digit set.
- See also:
- KLocale::formatDate
- Parameters:
-
fromDate the date to be formatted toFormat the date format to use formatStandard the standard the date format uses, defaults to KDE Standard
- Returns:
- The date as a string
Definition at line 1857 of file kcalendarsystem.cpp.
| QString KCalendarSystem::formatDate | ( | const QDate & | date, |
| KLocale::DateTimeComponent | component, | ||
| KLocale::DateTimeComponentFormat | format = KLocale::DefaultComponentFormat, |
||
| KLocale::WeekNumberSystem | weekNumberSystem = KLocale::DefaultWeekNumber |
||
| ) | const |
- Since:
- 4.6
Returns a Date Component as a localized string in the requested format.
For example for 2010-01-01 the KLocale::Month with en_US Locale and Gregorian calendar may return: KLocale::ShortNumber = "1" KLocale::LongNumber = "01" KLocale::NarrowName = "J" KLocale::ShortName = "Jan" KLocale::LongName = "January"
- Parameters:
-
date The date to format component The date component to return format The format to return the componentinweekNumberSystem To override the default Week Number System to use
- Returns:
- The localized string form of the date component
Definition at line 1876 of file kcalendarsystem.cpp.
| void KCalendarSystem::getDate | ( | const QDate | date, |
| int * | year, | ||
| int * | month, | ||
| int * | day | ||
| ) | const |
- Since:
- 4.5
Returns the year, month and day portion of a given date in the current calendar system
- Parameters:
-
date date to get year, month and day for year year number returned in this variable month month number returned in this variable day day of month returned in this variable
Definition at line 1072 of file kcalendarsystem.cpp.
| bool KCalendarSystem::isLeapYear | ( | int | year | ) | const [pure virtual] |
Returns whether a given year is a leap year.
Input year must be checked for validity in current Calendar System prior to calling, no validity checking performed in this routine, behaviour is undefined in invalid case.
- Parameters:
-
year the year to check
- Returns:
trueif the year is a leap year,falseotherwise
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1522 of file kcalendarsystem.cpp.
| bool KCalendarSystem::isLeapYear | ( | const QDate & | date | ) | const [virtual] |
Returns whether a given date falls in a leap year.
Input date must be checked for validity in current Calendar System prior to calling, no validity checking performed in this routine, behaviour is undefined in invalid case.
- Parameters:
-
date the date to check
- Returns:
trueif the date falls in a leap year,falseotherwise
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1533 of file kcalendarsystem.cpp.
| virtual bool KCalendarSystem::isLunar | ( | ) | const [pure virtual] |
Returns whether the calendar is lunar based.
- Returns:
trueif the calendar is lunar based,falseif not
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| virtual bool KCalendarSystem::isLunisolar | ( | ) | const [pure virtual] |
Returns whether the calendar is lunisolar based.
- Returns:
trueif the calendar is lunisolar based,falseif not
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| virtual bool KCalendarSystem::isProleptic | ( | ) | const [pure virtual] |
Returns whether the calendar system is proleptic, i.e.
whether dates before the epoch are supported.
- See also:
- KCalendarSystem::epoch
- Returns:
trueif the calendar system is proleptic,falseif not
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| virtual bool KCalendarSystem::isSolar | ( | ) | const [pure virtual] |
Returns whether the calendar is solar based.
- Returns:
trueif the calendar is solar based,falseif not
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| bool KCalendarSystem::isValid | ( | int | year, |
| int | month, | ||
| int | day | ||
| ) | const [pure virtual] |
Returns whether a given date is valid in this calendar system.
- Parameters:
-
year the year portion of the date to check month the month portion of the date to check day the day portion of the date to check
- Returns:
trueif the date is valid,falseotherwise
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 898 of file kcalendarsystem.cpp.
| bool KCalendarSystem::isValid | ( | int | year, |
| int | dayOfYear | ||
| ) | const |
- Since:
- 4.4
Returns whether a given date is valid in this calendar system.
- Parameters:
-
year the year portion of the date to check dayOfYear the day of year portion of the date to check
- Returns:
trueif the date is valid,falseotherwise
Definition at line 919 of file kcalendarsystem.cpp.
- Since:
- 4.5
Returns whether a given date is valid in this calendar system.
- Parameters:
-
era the Era Name portion of the date to check yearInEra the Year In Era portion of the date to check month the Month portion of the date to check day the Day portion of the date to check
- Returns:
trueif the date is valid,falseotherwise
Definition at line 927 of file kcalendarsystem.cpp.
| bool KCalendarSystem::isValid | ( | const QDate & | date | ) | const [virtual] |
Returns whether a given date is valid in this calendar system.
- Parameters:
-
date the date to check
- Returns:
trueif the date is valid,falseotherwise
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 979 of file kcalendarsystem.cpp.
| bool KCalendarSystem::isValidIsoWeekDate | ( | int | year, |
| int | isoWeekNumber, | ||
| int | dayOfIsoWeek | ||
| ) | const |
- Since:
- 4.4
Returns whether a given date is valid in this calendar system.
- Parameters:
-
year the year portion of the date to check isoWeekNumber the ISO week portion of the date to check dayOfIsoWeek the day of week portion of the date to check
- Returns:
trueif the date is valid,falseotherwise
Definition at line 936 of file kcalendarsystem.cpp.
| bool KCalendarSystem::julianDayToDate | ( | int | jd, |
| int & | year, | ||
| int & | month, | ||
| int & | day | ||
| ) | const [protected, pure virtual] |
Internal method to convert a Julian Day number into the YMD values for this calendar system.
All calendar system implementations MUST implement julianDayToDate and dateToJulianDay methods as all other methods can be expressed as functions of these. Does no internal validity checking.
- See also:
- KCalendarSystem::dateToJulianDay
- Parameters:
-
jd Julian day number to convert to date year year number returned in this variable month month number returned in this variable day day of month returned in this variable
- Returns:
trueif the date is valid,falseotherwise
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 2179 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::lastDayOfMonth | ( | int | year, |
| int | month | ||
| ) | const |
- Since:
- 4.6
Returns a QDate containing the last day of the month
- Parameters:
-
date The month to return the date for, defaults to today
- Returns:
- The last day of the month
Definition at line 1605 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::lastDayOfMonth | ( | const QDate & | date = QDate::currentDate() | ) | const |
- Since:
- 4.6
Returns a QDate containing the last day of the month
- Parameters:
-
date The month to return the date for, defaults to today
- Returns:
- The last day of the month
Definition at line 1631 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::lastDayOfYear | ( | int | year | ) | const |
- Since:
- 4.6
Returns a QDate containing the last day of the year
- Parameters:
-
date The year to return the date for
- Returns:
- The last day of the year
Definition at line 1557 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::lastDayOfYear | ( | const QDate & | date = QDate::currentDate() | ) | const |
- Since:
- 4.6
Returns a QDate containing the last day of the year
- Parameters:
-
date The year to return the date for, defaults to today
- Returns:
- The last day of the year
Definition at line 1581 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::latestValidDate | ( | ) | const [virtual] |
Returns the latest date valid in this calendar system implementation.
- Returns:
- date the latest valid date
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 892 of file kcalendarsystem.cpp.
| const KLocale * KCalendarSystem::locale | ( | ) | const [protected] |
Returns the locale used for translations and formats for this calendar system instance.
This allows a calendar system instance to be independent of the global translations and formats if required. All implementations must refer to this locale.
Only for internal calendar system use; if public access is required then provide public methods only for those methods actually required. Any app that creates an instance with its own locale overriding global will have the original handle to the locale and can manipulate it that way if required, e.g. to change default date format. Only expose those methods that library widgets require access to internally.
- See also:
- KCalendarSystem::formatDate
- KLocale::formatDate
- KCalendarSystem::weekStartDay
- KLocale::weekStartDay
- KCalendarSystem::readDate
- KLocale::readDate
- Returns:
- locale to use
Definition at line 2242 of file kcalendarsystem.cpp.
| int KCalendarSystem::month | ( | const QDate & | date | ) | const [virtual] |
Returns the month portion of a given date in the current calendar system.
- Parameters:
-
date date to return month for
- Returns:
- month of year, 0 if input date is invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1109 of file kcalendarsystem.cpp.
| QString KCalendarSystem::monthName | ( | const QDate & | date, |
| MonthNameFormat | format = LongName |
||
| ) | const [virtual] |
Gets specific calendar type month name for a given date.
- Parameters:
-
date date to obtain month from format specifies whether the short month name or long month name should be used
- Returns:
- name of the month, empty string if any error
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1644 of file kcalendarsystem.cpp.
| virtual QString KCalendarSystem::monthName | ( | int | month, |
| int | year, | ||
| MonthNameFormat | format = LongName |
||
| ) | const [pure virtual] |
Gets specific calendar type month name for a given month number If an invalid month is specified, QString() is returned.
- Parameters:
-
month the month number year the year the month belongs to format specifies whether the short month name or long month name should be used
- Returns:
- name of the month, empty string if any error
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| int KCalendarSystem::monthsDifference | ( | const QDate & | fromDate, |
| const QDate & | toDate | ||
| ) | const |
Returns the difference between two dates in completed calendar months The returned value will be negative if fromDate > toDate.
For example, the difference between 2010-06-10 and 2012-09-5 is 26 months. Note that the difference between two last days of the month is always 1 month, e.g. 2010-01-31 to 2010-02-28 is 1 month not 28 days.
- Parameters:
-
fromDate The date to start from toDate The date to end at
- Returns:
- The number of months difference
Definition at line 1307 of file kcalendarsystem.cpp.
| int KCalendarSystem::monthsInYear | ( | const QDate & | date | ) | const [virtual] |
Returns number of months in the given year.
- Parameters:
-
date the date to obtain year from
- Returns:
- number of months in the year, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1328 of file kcalendarsystem.cpp.
| int KCalendarSystem::monthsInYear | ( | int | year | ) | const |
- Since:
- 4.5
Returns number of months in the given year
- Parameters:
-
year the required year
- Returns:
- number of months in the year, -1 if input date invalid
Definition at line 1340 of file kcalendarsystem.cpp.
| QString KCalendarSystem::monthsInYearString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const |
- Since:
- 4.4
Returns the months in year for a date as a numeric string
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The months in year literal of the date, empty string if any error
- See also:
- monthsInYear()
Definition at line 1728 of file kcalendarsystem.cpp.
| QString KCalendarSystem::monthString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const [virtual] |
Converts a date into a month literal.
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The month literal of the date, empty string if any error
- See also:
- month()
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1673 of file kcalendarsystem.cpp.
| int KCalendarSystem::monthStringToInteger | ( | const QString & | sNum, |
| int & | iLength | ||
| ) | const [virtual] |
Converts a month literal of a part of a string into a integer starting at the beginning of the string
- Parameters:
-
sNum The string to parse iLength The number of QChars used, and 0 if no valid symbols was found in the string
- Returns:
- An integer corresponding to the month
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1801 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::readDate | ( | const QString & | dateString, |
| const QString & | dateFormat, | ||
| bool * | ok = 0 |
||
| ) | const [virtual] |
Converts a localized date string to a QDate, using the specified format.
You will usually not want to use this method. Uses teh KDE format standard.
- Parameters:
-
dateString the string to convert dateFormat the date format to use, in KDE format standard ok if non-null, will be set to trueif the date is valid,falseif invalid
- Returns:
- the string converted to a QDate
- See also:
- formatDate
- KLocale::readDate
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 2135 of file kcalendarsystem.cpp.
Converts a localized date string to a QDate.
The bool pointed by ok will be false if the date entered was invalid.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::readDate
- Parameters:
-
str the string to convert ok if non-null, will be set to trueif the date is valid,falseif invalid
- Returns:
- the string converted to a QDate
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 2096 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::readDate | ( | const QString & | str, |
| KLocale::ReadDateFlags | flags, | ||
| bool * | ok = 0 |
||
| ) | const [virtual] |
Converts a localized date string to a QDate.
This method is stricter than readDate(str,&ok): it will either accept a date in full format or a date in short format, depending on flags.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::readDate
- Parameters:
-
str the string to convert flags whether the date string is to be in full format or in short format ok if non-null, will be set to trueif the date is valid,falseif invalid
- Returns:
- the string converted to a QDate
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 2117 of file kcalendarsystem.cpp.
| QDate KCalendarSystem::readDate | ( | const QString & | dateString, |
| const QString & | dateFormat, | ||
| bool * | ok, | ||
| KLocale::DateTimeFormatStandard | formatStandard | ||
| ) | const |
Converts a localized date string to a QDate, using the specified format.
You will usually not want to use this method.
You must supply a format and string containing at least one of the following combinations to create a valid date:
- a month and day of month
- a day of year
- a ISO week number and day of week
If a year number is not supplied then the current year will be assumed.
All date componants must be separated by a non-numeric character.
The format is not applied strictly to the input string:
- extra whitespace is ignored
- leading 0's on numbers are ignored
- capitalisation of literals is ignored
The allowed format componants are almost the same as the formatDate() function. The following date componants will be read:
- Y the whole year (e.g. "1984" for 1984)
- y the lower 2 digits of the year (e.g. "84" for 1984)
- EY the full local era year (e.g. "2000 AD")
- EC the era name short form (e.g. "AD")
- Ey the year in era to 1 digit (e.g. 1 or 2000)
- m the month number to two digits (January="01", December="12")
- n the month number (January="1", December="12")
- d the day number of the month to two digits (e.g. "01" on the first of March)
- e the day number of the month (e.g. "1" on the first of March)
- B the month name long form (e.g. "January")
- b the month name short form (e.g. "Jan" for January)
- h the month name short form (e.g. "Jan" for January)
- A the weekday name long form (e.g. "Wednesday" for Wednesday)
- a the weekday name short form (e.g. "Wed" for Wednesday)
- j the day of the year number to three digits (e.g. "001" for 1 Jan)
- V the ISO week of the year number to two digits (e.g. "01" for ISO Week 1)
- u the day of the week number (e.g. "1" for Monday)
The following date componants are NOT supported:
- C the 'century' portion of the year (e.g. "19" for 1984, "5" for 584, "" for 84)
- G the year number in long form of the ISO week of the year (e.g. "2004" for 1 Jan 2005)
- g the year number in short form of the ISO week of the year (e.g. "04" for 1 Jan 2005)
- D the US short date format (e.g. "%m/%d/%y")
- F the ISO short date format (e.g. "%Y-%m-%d")
- x the KDE locale short date format
- %% the literal "%"
- t a tab character
- Parameters:
-
dateString the string to convert dateFormat the date format to use ok if non-null, will be set to trueif the date is valid,falseif invalidformatStandard the standard the date format uses
- Returns:
- the string converted to a QDate
- See also:
- formatDate
- KLocale::readDate
Definition at line 2141 of file kcalendarsystem.cpp.
| bool KCalendarSystem::setDate | ( | QDate & | date, |
| int | year, | ||
| int | month, | ||
| int | day | ||
| ) | const [virtual] |
Changes the date's year, month and day.
The range of the year, month and day depends on which calendar is being used. All years entered are treated literally, i.e. no Y2K translation is applied to years entered in the range 00 to 99. Replaces setYMD.
- Parameters:
-
date date to change year year month month number day day of month
- Returns:
trueif the date is valid,falseotherwise
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 987 of file kcalendarsystem.cpp.
| bool KCalendarSystem::setDate | ( | QDate & | date, |
| int | year, | ||
| int | dayOfYear | ||
| ) | const |
- Since:
- 4.4
Set a date using the year number and day of year number only.
- Parameters:
-
date date to change year year dayOfYear day of year
- Returns:
trueif the date is valid,falseotherwise
Definition at line 1008 of file kcalendarsystem.cpp.
| bool KCalendarSystem::setDate | ( | QDate & | date, |
| QString | eraName, | ||
| int | yearInEra, | ||
| int | month, | ||
| int | day | ||
| ) | const |
- Since:
- 4.5
Set a date using the era, year in era number, month and day
- Parameters:
-
date date to change eraName Era string year Year In Era number month Month number day Day Of Month number
- Returns:
trueif the date is valid,falseotherwise
Definition at line 1028 of file kcalendarsystem.cpp.
| bool KCalendarSystem::setDateIsoWeek | ( | QDate & | date, |
| int | year, | ||
| int | isoWeekNumber, | ||
| int | dayOfIsoWeek | ||
| ) | const |
- Since:
- 4.4
Set a date using the year number, ISO week number and day of week number.
- Parameters:
-
date date to change year year isoWeekNumber ISO week of year dayOfIsoWeek day of week Mon..Sun (1..7)
- Returns:
trueif the date is valid,falseotherwise
Definition at line 1037 of file kcalendarsystem.cpp.
| void KCalendarSystem::setHasYear0 | ( | bool | hasYear0 | ) | [protected] |
- Since:
- 4.4
Sets if Calendar System has Year 0 or not
Only for internal calendar system use
Definition at line 2262 of file kcalendarsystem.cpp.
| void KCalendarSystem::setMaxDaysInWeek | ( | int | maxDays | ) | [protected] |
Sets the maximum number of days in a week
Only for internal calendar system use
Definition at line 2256 of file kcalendarsystem.cpp.
| void KCalendarSystem::setMaxMonthsInYear | ( | int | maxMonths | ) | [protected] |
Sets the maximum number of months in a year
Only for internal calendar system use
Definition at line 2250 of file kcalendarsystem.cpp.
| bool KCalendarSystem::setYMD | ( | QDate & | date, |
| int | y, | ||
| int | m, | ||
| int | d | ||
| ) | const [virtual] |
Use setDate instead
- See also:
- KCalendarSystem::setDate
Some implementations reject year range 00 to 99, but extended date ranges now require these to be accepted. Equivalent in QDate is obsoleted.
Changes the date's year, month and day. The range of the year, month and day depends on which calendar is being used.
- Parameters:
-
date Date to change y Year m Month number d Day of month
- Returns:
- true if the date is valid; otherwise returns false.
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1066 of file kcalendarsystem.cpp.
| int KCalendarSystem::shortYearWindowStartYear | ( | ) | const |
- Since:
- 4.6
Returns the Short Year Window Start Year for the current Calendar System.
Use this function to get the Start Year for the Short Year Window to be applied when 2 digit years are entered for a Short Year input format, e.g. if the Short Year Window Start Year is 1930, then the input Short Year value of 40 is interpreted as 1940 and the input Short Year value of 10 is interpreted as 2010.
The Short Year Window is only ever applied when reading the Short Year format and not the Long Year format, i.e. KLocale::ShortFormat or 'y' only and not KLocale::LongFormat or 'Y'.
The Start Year 0 effectively means not to use a Short Year Window
Each Calendar System requires a different Short Year Window as they have different epochs. The Gregorian Short Year Window usually pivots around the year 2000, whereas the Hebrew Short Year Window usually pivots around the year 5000.
This value must always be used when evaluating user input Short Year strings.
- See also:
- KLocale::shortYearWindowStartYear
- KLocale::applyShortYearWindow
- Returns:
- the short year window start year
Definition at line 2153 of file kcalendarsystem.cpp.
| virtual QString KCalendarSystem::weekDayName | ( | int | weekDay, |
| WeekDayNameFormat | format = LongDayName |
||
| ) | const [pure virtual] |
Gets specific calendar type week day name.
If an invalid week day is specified, QString() is returned.
- Parameters:
-
weekDay number of day in week (Monday = 1, ..., Sunday = 7) format specifies whether the short month name or long month name should be used
- Returns:
- day name, empty string if any error
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| QString KCalendarSystem::weekDayName | ( | const QDate & | date, |
| WeekDayNameFormat | format = LongDayName |
||
| ) | const [virtual] |
Gets specific calendar type week day name.
- Parameters:
-
date the date format specifies whether the short month name or long month name should be used
- Returns:
- day name, empty string if any error
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1655 of file kcalendarsystem.cpp.
| virtual int KCalendarSystem::weekDayOfPray | ( | ) | const [pure virtual] |
Returns the day of the week traditionally associated with religious observance for this calendar system.
Note this may not be accurate for the users locale, e.g. Gregorian calendar used in non-Christian countries, in use cases where this could be an issue it is recommended to use KLocale::weekDayOfPray() instead.
- Returns:
- day number (None = 0, Monday = 1, ..., Sunday = 7)
Implemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
| int KCalendarSystem::weekNumber | ( | const QDate & | date, |
| int * | yearNum = 0 |
||
| ) | const [virtual] |
Returns the ISO week number for the given date.
ISO 8601 defines the first week of the year as the week containing the first Thursday. See http://en.wikipedia.org/wiki/ISO_8601 and http://en.wikipedia.org/wiki/ISO_week_date
If the date falls in the last week of the previous year or the first week of the following year, then the yearNum returned will be set to the appropriate year.
- Parameters:
-
date the date to obtain week from yearNum returns the year the date belongs to
- Returns:
- ISO week number, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1468 of file kcalendarsystem.cpp.
| QString KCalendarSystem::weekNumberString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const |
- Since:
- 4.4
Converts a date into a week number literal
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The day literal of the date, empty string if any error
- See also:
- weekNumber()
Definition at line 1718 of file kcalendarsystem.cpp.
| int KCalendarSystem::weeksInYear | ( | int | year | ) | const [virtual] |
Returns the number of ISO weeks in the given year.
ISO 8601 defines the first week of the year as the week containing the first Thursday. See http://en.wikipedia.org/wiki/ISO_8601 and http://en.wikipedia.org/wiki/ISO_week_date
- Parameters:
-
year the year
- Returns:
- number of weeks in the year, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1361 of file kcalendarsystem.cpp.
| int KCalendarSystem::weeksInYear | ( | const QDate & | date | ) | const [virtual] |
Returns the number of ISO weeks in the given year.
- Parameters:
-
date the date to obtain year from
- Returns:
- number of weeks in the year, -1 if input date invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1351 of file kcalendarsystem.cpp.
| QString KCalendarSystem::weeksInYearString | ( | const QDate & | pDate, |
| StringFormat | format = LongFormat |
||
| ) | const |
- Since:
- 4.4
Returns the weeks in year for a date as a numeric string
- Parameters:
-
pDate The date to convert format The format to return, either short or long
- Returns:
- The weeks in year literal of the date, empty string if any error
- See also:
- weeksInYear()
Definition at line 1740 of file kcalendarsystem.cpp.
| int KCalendarSystem::weekStartDay | ( | ) | const [virtual] |
Use this to determine which day is the first day of the week.
Uses the calendar system's internal locale set when the instance was created, which ensures that the correct calendar system and locale settings are respected, which would not occur in some cases if using the global locale. Defaults to global locale.
- See also:
- KLocale::weekStartDay
- Returns:
- an integer (Monday = 1, ..., Sunday = 7)
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 2168 of file kcalendarsystem.cpp.
| int KCalendarSystem::year | ( | const QDate & | date | ) | const [virtual] |
Returns the year portion of a given date in the current calendar system.
- Parameters:
-
date date to return year for
- Returns:
- year, 0 if input date is invalid
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1096 of file kcalendarsystem.cpp.
| int KCalendarSystem::yearInEra | ( | const QDate & | date | ) | const |
- Since:
- 4.5
Returns the Year In Era portion of a given date in the current calendar system, for example 1 for "1 BC".
- Parameters:
-
date date to return Year In Era for
- Returns:
- Year In Era, -1 if input date is invalid
Definition at line 1165 of file kcalendarsystem.cpp.
| QString KCalendarSystem::yearInEraString | ( | const QDate & | date, |
| StringFormat | format = ShortFormat |
||
| ) | const |
- Since:
- 4.5
Converts a date into a Year In Era literal
- Parameters:
-
date date to return Year In Era for format format to return, either short or long
- Returns:
- Year In Era literal of the date, empty string if any error
Definition at line 1692 of file kcalendarsystem.cpp.
| int KCalendarSystem::yearsDifference | ( | const QDate & | fromDate, |
| const QDate & | toDate | ||
| ) | const |
Returns the difference between two dates in completed calendar years.
The returned value will be negative if fromDate > toDate.
For example, the difference between 2010-06-10 and 2012-09-5 is 2 years.
- Parameters:
-
fromDate The date to start from toDate The date to end at
- Returns:
- The number of years difference
Definition at line 1295 of file kcalendarsystem.cpp.
| QString KCalendarSystem::yearString | ( | const QDate & | date, |
| StringFormat | format = LongFormat |
||
| ) | const [virtual] |
Converts a date into a year literal.
- Parameters:
-
date date to convert format format to return, either short or long
- Returns:
- year literal of the date, empty string if any error
- See also:
- year()
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1664 of file kcalendarsystem.cpp.
| int KCalendarSystem::yearStringToInteger | ( | const QString & | sNum, |
| int & | iLength | ||
| ) | const [virtual] |
Converts a year literal of a part of a string into a integer starting at the beginning of the string
- Parameters:
-
sNum The string to parse iLength The number of QChars used, and 0 if no valid symbols was found in the string
- Returns:
- An integer corresponding to the year
Reimplemented in KCalendarSystemCoptic, KCalendarSystemEthiopian, KCalendarSystemGregorian, KCalendarSystemGregorianProleptic, KCalendarSystemHebrew, KCalendarSystemHijri, KCalendarSystemIndianNational, KCalendarSystemJalali, KCalendarSystemJapanese, KCalendarSystemJulian, KCalendarSystemMinguo, and KCalendarSystemThai.
Definition at line 1783 of file kcalendarsystem.cpp.
The documentation for this class was generated from the following files:
KDE 4.6 API Reference