Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QTimeString Class Reference
[QtBaseModule]

The QTimeString class provides localized strings for times and dates. More...

    #include <QTimeString>

Public Types

Static Public Members


Detailed Description

The QTimeString class provides localized strings for times and dates.

It is recommended to use QTimeString rather than QDateTime::toString() because QTimeString returns localized strings for a given date and/or time. Each function expects a parameter that determines the length of a returned string. If the user changes the date or time format all strings obtained from QTimeString have to be invalidated. The QtopiaApplication::dateFormatChanged() and QtopiaApplication::clockChanged() signals will indicate when this happens. The handler for these signals must ensure that all time/date strings are refreshed.

Warning: The length of the localized string can vary among languages.

See also QtopiaApplication::dateFormatChanged() and QtopiaApplication::clockChanged().


Member Type Documentation

enum QTimeString::Length

This enum specifies the different string lengths supported by QTimeString.

ConstantValueDescription
QTimeString::Short0Returns shortest possible string (mostly used on phones).
QTimeString::Medium1Returns default length string.
QTimeString::Long2Returns verbose string.


Member Function Documentation

bool QTimeString::currentAMPM ()   [static]

Returns true if 12 hour time is preferred over 24 hour time; otherwise returns false.

QString QTimeString::currentFormat ()   [static]

Returns the date format used by QTimeString (e.g. D.M.Y) if set; otherwise returns an empty string.

In case no format is set the default format which is returned by QLocale::dateFormat() in QLocale::ShortFormat is used.

See also QTimeString::formatOptions().

QStringList QTimeString::formatOptions ()   [static]

Returns additional format options for a date string. The default format is the format of the current locale as returned by QLocale::dateFormat() in QLocale::ShortFormat.

See also QTimeString::currentFormat().

QString QTimeString::localDayOfWeek ( const QDate & date, Length len = Medium )   [static]

Returns a localized name of the week day on date in the given len.

QString QTimeString::localH ( int hour )   [static]

Returns a localized string for hour, in 12 hour if QTimeString::currentAMPM() is true; otherwise in 24 hour format.

If hour is greater than 23 or less then 0 then hour will default to 0.

QString QTimeString::localHM ( const QTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours and minutes.

The format, including order depends on the user's settings.

QString QTimeString::localHMDayOfWeek ( const QDateTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours, minutes, and day of the week.

The format, including order depends on the user's settings.

QString QTimeString::localHMS ( const QTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours, minutes, and seconds.

The format, including order depends on the user's settings.

QString QTimeString::localHMSDayOfWeek ( const QDateTime & t, Length len = Medium )   [static]

Returns a localized string for t in the given len, showing hours, minutes, seconds, and day of the week.

The format, including order depends on the user's settings.

QString QTimeString::localMD ( const QDate & dt, Length len = Medium )   [static]

Returns a localized string for dt in the given len, showing month and date.

The format, including the order of month and date depends on the user's current locale.

QString QTimeString::localYMD ( const QDate & dt, Length len = Medium )   [static]

Returns a localized string for dt in the given len showing year, month, and date.

The format, including order depends on the user's settings.

QString QTimeString::localYMDHMS ( const QDateTime & dt, Length len = Medium )   [static]

Returns a localized string for dt in the given len, showing year, month, date, hours, minutes, and seconds.

The format, including order depends on the user's settings.

QString QTimeString::nameOfMonth ( int month, Length len = Medium )   [static]

Returns the name of month in the given len.

QString QTimeString::nameOfWeekDay ( int day, Length len = Medium )   [static]

Returns the name for the day of the week in the given len.

QString QTimeString::numberDateString ( const QDate & date, Length len = Medium )   [static]

Returns a localized string for date showing day, month and year as a number in the given len.

The format, including order depends on the user's settings.


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3