Defines the time zone API which specifies a time zone, allows you to display it to the user, and converts between GMT and local time. More...
Public Member Functions | |
BTimeZone (const BTimeZone &other) | |
Copy constructor. | |
BTimeZone (const char *zoneID=NULL, const BLanguage *language=NULL) | |
Construct a timezone from its zoneID and language. | |
const BString & | DaylightSavingName () const |
Returns the localized daylight savings name of the time zone, for example "Pacific Daylight Time". | |
const BString & | ID () const |
Returns the ID of the time zone as a BString, for example, "America/Los_Angeles". | |
status_t | InitCheck () const |
Returns whether or not the constructor initialized the time zone. | |
const BString & | Name () const |
Returns the localized name of the time zone, for example "Pacific Standard Time". | |
int | OffsetFromGMT () const |
Returns the offset, in milliseconds, between the standard time of a time zone and GMT. | |
BTimeZone & | operator= (const BTimeZone &source) |
Assignment operator. | |
status_t | SetTo (const char *zoneID, const BLanguage *language=NULL) |
Set the BTimeZone object to use a different time zone. | |
const BString & | ShortDaylightSavingName () const |
Returns the localized daylight savings name of the time zone, for example "PDT". | |
const BString & | ShortName () const |
Returns the short name of the timezone, in the user's locale, for example "PST". | |
bool | SupportsDaylightSaving () const |
Returns whether or not if the time zone support daylight saving time. | |
Defines the time zone API which specifies a time zone, allows you to display it to the user, and converts between GMT and local time.
When displaying the name of a time zone to the user, use the display name, not the time zone ID. The display name can be retrieved by the BTimeZone::Name(), BTimeZone::DaylightSavingName(), BTimeZone::ShortName(), and BTimeZone::ShortDaylightSavingName() methods.
Construct a timezone from its zoneID and language.
The constructor only allows you to construct a timezone if you already know its code. If you don't know the code, you can instead go through the BCountry class which can enumerate all timezones in a country, or use the BLocaleRoster, which knows the timezone selected by the user.
zoneID | A time zone ID, for example, "America/Los_Angeles". This ID is used to call up a specific real-world time zone. |
language | The language to use when displaying the time zone. |
BTimeZone::BTimeZone | ( | const BTimeZone & | other | ) |
const BString & BTimeZone::DaylightSavingName | ( | ) | const |
Returns the localized daylight savings name of the time zone, for example "Pacific Daylight Time".
const BString & BTimeZone::ID | ( | ) | const |
Returns the ID of the time zone as a BString, for example, "America/Los_Angeles".
When displaying the name of a time zone to the user, use the display name, not the time zone ID.
status_t BTimeZone::InitCheck | ( | ) | const |
const BString & BTimeZone::Name | ( | ) | const |
Returns the localized name of the time zone, for example "Pacific Standard Time".
Use this method to display the time zone's name to the user.
int BTimeZone::OffsetFromGMT | ( | ) | const |
Returns the offset, in milliseconds, between the standard time of a time zone and GMT.
Positive raw offsets are east of Greenwich, negative offsets are west of Greenwich.
Set the BTimeZone object to use a different time zone.
zoneCode | The time zone ID to use, for example "America/Los_Angeles". |
language | The language to use when displaying the time zone. |
true
if time zone was set successfully, false
if there was an error setting the time zone, for instance if this method was called using an invalid zoneCode.const BString & BTimeZone::ShortDaylightSavingName | ( | ) | const |
Returns the localized daylight savings name of the time zone, for example "PDT".
const BString & BTimeZone::ShortName | ( | ) | const |
Returns the short name of the timezone, in the user's locale, for example "PST".
bool BTimeZone::SupportsDaylightSaving | ( | ) | const |
Returns whether or not if the time zone support daylight saving time.
true
if the time zone supports daylight savings time, false
otherwise.