Detailed Description
The QTimeZone class provides access to time zone data.
QTimeZone provides access to timezone data and conversion between dates and times in different time zones.
A time zone is a region of the world that has adopted the same standard time, including conventions on Daylight Saving or Summer time adjustments.
Each time zone is specified by a unique identifier. A set of such identifiers is known to the system, and can be found using ids().
Conversions between time zones can either be done via UTC, using fromUtc() and toUtc(), or directly with convert(), fromCurrent(), or toCurrent().
Each time zone is in a greater area() and has an associated city() that observes the standard. This city is not necessarily the capital, just a well-known city in the area. More than one city in an area may observe identical standards, yet they will appear as distinct time zones. The countyCode() of the country containing the time zone is also available.
A QTimeZone either isValid() or is not valid. The default constructor creates an invalid QTimeZone.
Note that some features of QTimeZone may not be available on non-POSIX platforms.
See also QtopiaApplication::timeChanged().
Member Function Documentation
QTimeZone::QTimeZone ()
Construct an invalid time zone.
QTimeZone::QTimeZone ( const char * locId )
Construct a QTimeZone for location locId. The time zone isValid() if locId is a valid time zone identifier in the list of ids().
QTimeZone::QTimeZone ( const QTimeZone & other )
Constructs a copy of the other QTimeZone.
QTimeZone::~QTimeZone ()
Destruct QTimeZone.
QString QTimeZone::area () const
Returns the translated greater area of this time zone, e.g. Europe.
QString QTimeZone::city () const
Returns the translated city of this time zone, e.g. Oslo, or a null string if no specific city is identified.
QDateTime QTimeZone::convert ( const QDateTime & dt, const QTimeZone & dtTz ) const
Return the date and time dt in time zone dtTz as the date and time in this time zone.
QString QTimeZone::countryCode ()
Returns the ISO 3166 2-character country code.
QTimeZone QTimeZone::current () [static]
Returns the current system time zone.
QString QTimeZone::description () const
Returns the translated description of this time zone.
QString QTimeZone::dstAbbreviation () const
Returns the Daylight Savings Time (DST) time zone abbreviation.
QTimeZone QTimeZone::findFromMinutesEast ( const QDateTime & t, int mineast, bool isdst ) [static]
Returns a time zone that, at time t, is mineast minutes ahead of GMT, and is observing Daylight Time according to isdst.
Usually, the returned timezone will be a UNIX GMT time zone offset (eg. "GMT-10" for 10 hours East of GMT), however, if no such timezone exists (eg. for half-hour time zones), a city time zone will be returned.
QDateTime QTimeZone::fromCurrent ( const QDateTime & curT ) const
Returns the date and time curT in the current time zone as the date and time in this time zone.
See also current().
QDateTime QTimeZone::fromUtc ( const QDateTime & utc ) const
Returns the UTC date and time utc as a date and time in this time zone.
QString QTimeZone::id () const
Return the time zone identifier, for example, Europe/London
See also setId().
QStringList QTimeZone::ids () [static]
Returns a list of all time zone ids known to the system.
bool QTimeZone::isValid () const
Returns true if this is a valid time zone, otherwise false.
int QTimeZone::latitude () const
Returns the latitude of the city() of this timezone, in seconds of a degree.
int QTimeZone::longitude () const
Returns the longitude of the city() of this timezone, in seconds of a degree.
QString QTimeZone::name () const
Returns either the city() for this time zone, or some other string meaningful to the user (eg. "GMT+10" meaning 10 hours East of GMT).
void QTimeZone::setApplicationTimeZone ( const QString & newtz ) [static]
Sets the application time zone to newtz.
void QTimeZone::setId ( const char * id )
Sets the time zone id of this QTimeZone to id.
See also id().
void QTimeZone::setSystemTimeZone ( const QString & newtz ) [static]
Sets the system time zone to newtz.
QString QTimeZone::standardAbbreviation () const
Returns the time zone abbreviation, e.g. EST
QDateTime QTimeZone::toCurrent ( const QDateTime & dt ) const
Returns the date and time dt in this time zone as the date and time in the current system time zone.
See also current().
uint QTimeZone::toTime_t ( const QDateTime & dt ) const
Returns the date and time dt in this time zone, as the number of seconds since 1 January 1970.
QDateTime QTimeZone::toUtc ( const QDateTime & dt ) const
Returns the date and time dt in this time zone as a date and time in UTC.
QTimeZone QTimeZone::utc () [static]
Return a time zone located at the UTC reference.
QDateTime QTimeZone::utcDateTime () [static]
Return the current system UTC date and time.
bool QTimeZone::operator!= ( const QTimeZone & c ) const
Returns true if c is not equal to this, otherwise false.
QTimeZone & QTimeZone::operator= ( const QTimeZone & from )
Assign time zone from to this time zone.
bool QTimeZone::operator== ( const QTimeZone & c ) const
Returns true if c is equal to this, otherwise false.