KDECore
kdatetimeformatter.cpp
Go to the documentation of this file.
59 return formatDateTime(KDateTime(fromDate), toFormat, 0, calendar, locale, digitSet, formatStandard);
75 return formatDateTime(KDateTime(QDate::currentDate(), fromTime), toFormat, timeOptions, calendar, locale, digitSet, formatStandard);
95 return formatDateTimePosix(fromDateTime, toFormat, timeOptions, calendar, locale, digitSet, formatStandard);
164 } else if (!escapeMod && !escapeWidth && (thisChar == QLatin1Char('^') || thisChar == QLatin1Char('#'))) { // Change case
170 (escapeWidth && thisChar >= QLatin1Char('0') && thisChar <= QLatin1Char('9')))) { // Change width
178 } else if (!escapeMod && (thisChar == QLatin1Char('E') || thisChar == QLatin1Char('O') || thisChar == QLatin1Char(':'))) { // Set modifier
196 //Default settings unless overridden by pad and case flags and width: are 0 pad to 0 width no sign
202 if (modifierChar != QLatin1Char(':')) { // E and O mods are ignored if not used, but : is treated as literal
223 } else if (modifierChar != QLatin1Char(':')) { //Long year numeric, default 0 pad to 4 places with sign
237 } else if (modifierChar != QLatin1Char(':')) { //Century numeric, default 0 pad to 2 places with sign
249 } else if (modifierChar != QLatin1Char(':')) { //Short year numeric, default 0 pad to 2 places with sign
259 if (modifierChar == QLatin1Char(':')) { //Short month numeric, default no pad to 1 places no sign
316 componentString = m_englishCalendar->monthName(month, year, KCalendarSystem::LongNamePossessive);
339 componentString = m_englishCalendar->monthName(month, year, KCalendarSystem::ShortNamePossessive);
360 componentString = m_englishCalendar->weekDayName(fromDateTime.date(), KCalendarSystem::LongDayName);
372 componentString = m_englishCalendar->weekDayName(fromDateTime.date(), KCalendarSystem::ShortDayName);
436 componentString = formatDateTimePosix(fromDateTime, QString::fromLatin1("%m/%d/%y"), timeOptions, calendar, locale, digitSet, formatStandard);
444 componentString = formatDateTimePosix(fromDateTime, QString::fromLatin1("%Y-%m-%d"), timeOptions, calendar, locale, digitSet, formatStandard);
452 componentString = formatDateTimePosix(fromDateTime, locale->dateFormatShort(), timeOptions, calendar, locale, digitSet, formatStandard);
474 componentInteger = locale->d->dayPeriodForTime(fromDateTime.time()).hourInPeriod(fromDateTime.time());
527 componentString = m_englishLocale->d->dayPeriodForTime(fromDateTime.time()).periodName(KLocale::ShortName);
529 componentString = locale->d->dayPeriodForTime(fromDateTime.time()).periodName(KLocale::ShortName);
552 QString hourComponent = stringFromInteger(offsetHours, 2, QLatin1Char('0'), signChar, digitSet, locale);
553 QString minuteComponent = stringFromInteger(offsetMinutes, 2, QLatin1Char('0'), QChar(), digitSet, locale);
593 componentString = stringFromInteger(componentInteger, padWidth, padChar, signChar, digitSet, locale);
626 void KDateTimeFormatter::initEnglish(const KCalendarSystem *calendar, const KLocale *locale) const
721 result = QString::number(calendar->day(fromDateTime.date())).rightJustified(2, QLatin1Char('0'), true);
727 result = calendar->monthName(calendar->month(fromDateTime.date()), calendar->year(fromDateTime.date()), KCalendarSystem::LongName);
730 result = calendar->monthName(calendar->month(fromDateTime.date()), calendar->year(fromDateTime.date()), KCalendarSystem::ShortName);
733 result = QString::number(calendar->month(fromDateTime.date())).rightJustified(2, QLatin1Char('0'), true);
748 result = QString::number(calendar->year(fromDateTime.date())).right(2).rightJustified(2, QLatin1Char('0'));
756 return result + getUnicodeString(fromDateTime, toFormat.mid(removed), timeOptions, calendar, locale, digitSet);
761 QString KDateTimeFormatter::stringFromInteger(int number, int padWidth, QChar padChar, QChar signChar,
782 if (padChar == QLatin1Char('0')) { // If zero-padded, zero considered part of the number, so pad the number then prepend the sign
784 result = locale->convertDigits(QString::number(number).rightJustified(padWidth, padChar).prepend(signChar), digitSet);
785 } else { // If space-padded space not considered part of the number, so prepend the sign and then pad the number
787 result = locale->convertDigits(QString::number(number).prepend(signChar).rightJustified(padWidth, padChar), digitSet);
791 result = locale->convertDigits(QString::number(number).rightJustified(padWidth, padChar), digitSet);
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon May 5 2014 18:04:43 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon May 5 2014 18:04:43 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.