KDECore
klocalizeddate.cpp
Go to the documentation of this file.
34 explicit KLocalizedDatePrivate(const QDate &date, const KCalendarSystem *calendar, bool manageCalendar);
44KLocalizedDatePrivate::KLocalizedDatePrivate(const QDate &date, const KCalendarSystem *calendar, bool manageCalendar)
61 m_calendar = KCalendarSystem::create(m_calendar->calendarSystem(), new KLocale(*m_calendar->locale()));
73 m_calendar = KCalendarSystem::create(m_calendar->calendarSystem(), new KLocale(*m_calendar->locale()));
98KLocalizedDate::KLocalizedDate(int year, int month, int day, const KCalendarSystem *calendarSystem)
203bool KLocalizedDate::setDate(KLocale::WeekNumberSystem weekNumberSystem, int year, int isoWeekNumber, int dayOfIsoWeek)
354QString KLocalizedDate::formatDate(const QString &toFormat, KLocale::DateTimeFormatStandard formatStandard) const
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE.
Definition: kcalendarsystem.h:41
int yearsDifference(const QDate &fromDate, const QDate &toDate) const
Returns the difference between two dates in completed calendar years.
Definition: kcalendarsystem.cpp:1530
virtual int dayOfWeek(const QDate &date) const
Returns the weekday number for the given date.
Definition: kcalendarsystem.cpp:1686
virtual int day(const QDate &date) const
Returns the day portion of a given date in the current calendar system.
Definition: kcalendarsystem.cpp:1357
virtual int year(const QDate &date) const
Returns the year portion of a given date in the current calendar system.
Definition: kcalendarsystem.cpp:1331
virtual int daysInMonth(const QDate &date) const
Returns the number of days in the given month.
Definition: kcalendarsystem.cpp:1643
virtual bool isLeapYear(int year) const =0
Returns whether a given year is a leap year.
Definition: kcalendarsystem.cpp:1720
int daysDifference(const QDate &fromDate, const QDate &toDate) const
Returns the difference between two dates in days The returned value will be negative if fromDate > to...
Definition: kcalendarsystem.cpp:1554
static KCalendarSystem * create(const QString &calType=QLatin1String("gregorian"), const KLocale *locale=0)
Definition: kcalendarsystem.cpp:47
static KLocale::CalendarSystem calendarSystem(const QString &calendarType)
Definition: kcalendarsystem.cpp:183
virtual QDate readDate(const QString &str, bool *ok=0) const
Converts a localized date string to a QDate.
Definition: kcalendarsystem.cpp:2333
int yearInEra(const QDate &date) const
Definition: kcalendarsystem.cpp:1400
virtual QString formatDate(const QDate &fromDate, KLocale::DateFormat toFormat=KLocale::LongDate) const
Returns a string formatted to the current locale's conventions regarding dates.
Definition: kcalendarsystem.cpp:2048
void 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.
Definition: kcalendarsystem.cpp:1519
int week(const QDate &date, int *yearNum=0) const
Returns the localized Week Number for the date.
Definition: kcalendarsystem.cpp:1703
virtual bool isValid(int year, int month, int day) const =0
Returns whether a given date is valid in this calendar system.
Definition: kcalendarsystem.cpp:1133
void getDate(const QDate date, int *year, int *month, int *day) const
Definition: kcalendarsystem.cpp:1307
virtual int dayOfYear(const QDate &date) const
Returns the day number of year for the given date.
Definition: kcalendarsystem.cpp:1675
int monthsDifference(const QDate &fromDate, const QDate &toDate) const
Returns the difference between two dates in completed calendar months The returned value will be nega...
Definition: kcalendarsystem.cpp:1542
virtual QDate addMonths(const QDate &date, int nmonths) const
Returns a QDate containing a date nmonths months later.
Definition: kcalendarsystem.cpp:1463
virtual int daysInYear(const QDate &date) const
Returns the number of days in the given year.
Definition: kcalendarsystem.cpp:1620
static QString calendarLabel(const QString &calendarType)
Definition: kcalendarsystem.cpp:78
virtual int monthsInYear(const QDate &date) const
Returns number of months in the given year.
Definition: kcalendarsystem.cpp:1563
virtual QDate addDays(const QDate &date, int ndays) const
Returns a QDate containing a date ndays days later.
Definition: kcalendarsystem.cpp:1502
bool setDateIsoWeek(QDate &date, int year, int isoWeekNumber, int dayOfIsoWeek) const
Definition: kcalendarsystem.cpp:1272
virtual int weeksInYear(const QDate &date) const
Returns the number of localized weeks in the given year.
Definition: kcalendarsystem.cpp:1586
virtual QDate addYears(const QDate &date, int nyears) const
Returns a QDate containing a date nyears years later.
Definition: kcalendarsystem.cpp:1435
virtual int month(const QDate &date) const
Returns the month portion of a given date in the current calendar system.
Definition: kcalendarsystem.cpp:1344
virtual bool setDate(QDate &date, int year, int month, int day) const
Changes the date's year, month and day.
Definition: kcalendarsystem.cpp:1222
virtual int daysInWeek(const QDate &date) const
Returns the number of days in the given week.
Definition: kcalendarsystem.cpp:1668
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:70
const KCalendarSystem * calendar() const
Returns a pointer to the calendar system object.
Definition: klocale.cpp:705
@ QDateCalendar
KDE Default, hybrid of Gregorian and Julian as used by QDate.
Definition: klocale.h:781
A class representing a date localized using the local calendar system, language and formats.
Definition: klocalizeddate.h:139
static KLocalizedDate currentDate()
Returns a KLocalizedDate set to today's date in the Global Locale and Calendar System.
Definition: klocalizeddate.cpp:222
int day() const
Returns the day portion of the date in the current calendar system.
Definition: klocalizeddate.cpp:268
bool operator>=(const KLocalizedDate &other) const
KLocalizedDate greater than or equal to operator.
Definition: klocalizeddate.cpp:580
KLocalizedDate addMonths(int months) const
Returns a KLocalizedDate containing a date months months later.
Definition: klocalizeddate.cpp:428
static KLocalizedDate readDate(const QString &dateString, KLocale::DateTimeParseMode parseMode=KLocale::LiberalParsing, const KCalendarSystem *calendar=0)
Converts a localized date string to a KLocalizedDate using either the Global Calendar System and Loca...
Definition: klocalizeddate.cpp:372
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Set the Calendar System used for this date instance only.
Definition: klocalizeddate.cpp:131
int week(int *yearNum=0) const
Returns the localized Week Number for the date.
Definition: klocalizeddate.cpp:298
int yearsDifference(const KLocalizedDate &toDate) const
Returns the difference between this and another date in completed calendar years in the current Calen...
Definition: klocalizeddate.cpp:466
KLocalizedDate lastDayOfMonth() const
Returns a KLocalizedDate containing the last day of the currently set month.
Definition: klocalizeddate.cpp:517
QString eraName() const
Returns the Era Name portion of the date in the current calendar system, for example "AD" or "Anno Do...
Definition: klocalizeddate.cpp:273
KLocalizedDate firstDayOfYear() const
Returns a KLocalizedDate containing the first day of the currently set year.
Definition: klocalizeddate.cpp:496
int yearInEra() const
Returns the Year In Era portion of the date in the current calendar system, for example 1 for "1 BC".
Definition: klocalizeddate.cpp:283
QString formatDate(KLocale::DateFormat dateFormat=KLocale::LongDate) const
Returns the Date as a localized string in the requested standard Locale format.
Definition: klocalizeddate.cpp:349
int weeksInYear() const
Returns the number of localized weeks in the currently set year.
Definition: klocalizeddate.cpp:313
int month() const
Returns the month portion of the date in the current calendar system.
Definition: klocalizeddate.cpp:263
KLocalizedDate & operator=(const KLocalizedDate &rhs)
Assignment operator.
Definition: klocalizeddate.cpp:109
KLocalizedDate lastDayOfYear() const
Returns a KLocalizedDate containing the last day of the currently set year.
Definition: klocalizeddate.cpp:503
static KLocalizedDate fromJulianDay(int jd)
Returns a KLocalizedDate set the required Julian Day number in the Global Locale and Calendar System.
Definition: klocalizeddate.cpp:232
bool operator>(const KLocalizedDate &other) const
KLocalizedDate greater than operator.
Definition: klocalizeddate.cpp:570
KLocalizedDate addDays(int days) const
Returns a KLocalizedDate containing a date days days later.
Definition: klocalizeddate.cpp:441
const KCalendarSystem * calendar() const
Returns a pointer to the Calendar System object used by this date instance.
Definition: klocalizeddate.cpp:149
KLocalizedDate(const QDate &date=QDate(), const KCalendarSystem *calendar=0)
Constructs a localized date with the given date.
Definition: klocalizeddate.cpp:93
bool operator<(const KLocalizedDate &other) const
KLocalizedDate less than operator.
Definition: klocalizeddate.cpp:550
int toJulianDay() const
Returns the currently set date as a Julian Day number.
Definition: klocalizeddate.cpp:243
void dateDifference(const KLocalizedDate &toDate, int *yearsDiff, int *monthsDiff, int *daysDiff, int *direction) const
Returns the difference between this and another date in years, months and days in the current Calenda...
Definition: klocalizeddate.cpp:454
KLocalizedDate firstDayOfMonth() const
Returns a KLocalizedDate containing the first day of the currently set month.
Definition: klocalizeddate.cpp:510
bool isLeapYear() const
Returns whether the currently set date falls in a Leap Year in the current Calendar System.
Definition: klocalizeddate.cpp:338
KLocalizedDate addYears(int years) const
Returns a KLocalizedDate containing a date years years later.
Definition: klocalizeddate.cpp:414
bool operator!=(const KLocalizedDate &other) const
KLocalizedDate inequality operator.
Definition: klocalizeddate.cpp:540
bool isValid() const
Returns whether the date is valid in the current Calendar System.
Definition: klocalizeddate.cpp:168
bool operator==(const KLocalizedDate &other) const
KLocalizedDate equality operator.
Definition: klocalizeddate.cpp:530
int year() const
Returns the year portion of the date in the current calendar system.
Definition: klocalizeddate.cpp:258
int monthsDifference(const KLocalizedDate &toDate) const
Returns the difference between this and another date in completed calendar months in the current Cale...
Definition: klocalizeddate.cpp:476
bool operator<=(const KLocalizedDate &other) const
KLocalizedDate less than or equal to operator.
Definition: klocalizeddate.cpp:560
static KLocalizedDate fromDate(const QDate &date)
Returns a KLocalizedDate set the required date in the Global Locale and Calendar System.
Definition: klocalizeddate.cpp:227
QString eraYear() const
Returns the Era Year portion of the date in the current calendar system, for example "2000 AD" or "He...
Definition: klocalizeddate.cpp:278
int daysDifference(const KLocalizedDate &toDate) const
Returns the difference between this and another date in days The returned value will be negative if t...
Definition: klocalizeddate.cpp:486
void getDate(int *year, int *month, int *day) const
Returns the year, month and day portion of the date in the current Calendar System.
Definition: klocalizeddate.cpp:253
KLocale::CalendarSystem calendarSystem()
Returns the Calendar System used by this localized date instance.
Definition: klocalizeddate.cpp:144
QDataStream & operator>>(QDataStream &in, KLocalizedDate &date)
Data stream input operator.
Definition: klocalizeddate.cpp:595
QDataStream & operator<<(QDataStream &out, const KLocalizedDate &date)
Data stream output operator.
Definition: klocalizeddate.cpp:590
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.