setTimeZone()
Sets the time zone with the given time zone value. A time zone ID can be a value from the below list or a custom time zone ID as explained below.
Syntax
Calendar setTimeZone(String timeZone)
- timeZone is one of the supported time zones or a custom time zone.
Supported time zones
|
|
|
|
Custom time zones
If the time zone you want is not represented by one of the supported IDs, then a custom time zone ID can be specified:
CustomID:
GMTSignHours:Minutes
GMTSignHoursMinutes
GMTSignHours
Sign: one of
+ -
Hours:
Digit
DigitDigit
Minutes:
DigitDigit
Digit: one of
0 1 2 3 4 5 6 7 8 9
Hours must be between 0 to 23 and Minutes must be between 00 to 59. For example, "GMT+10" and "GMT+0010" mean ten hours and ten minutes ahead of GMT, respectively.
The format is locale independent and digits must be taken from the Basic Latin block of the Unicode standard. No daylight saving time transition schedule can be specified with a custom time zone ID. If the specified string doesn't match the syntax, "GMT" is used.
For example, setTimeZone("GMT-8")
sets the time zone to
"GMT-08:00".