public final class UtcOffset extends Object
Constructor and Description |
---|
UtcOffset(int hour,
int minute)
Creates a new UTC offset.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
getHour()
Gets the hour component.
|
int |
getMinute()
Gets the minute component.
|
int |
hashCode() |
static UtcOffset |
parse(String text)
Parses a UTC offset from a string.
|
static UtcOffset |
parse(TimeZone timezone)
Creates a UTC offset from a
TimeZone object. |
String |
toString()
Converts this offset to its ISO string representation using "basic"
format.
|
String |
toString(boolean extended)
Converts this offset to its ISO string representation.
|
public UtcOffset(int hour, int minute)
hour
- the hour component (may be negative)minute
- the minute component (must be between 0 and 59)public static UtcOffset parse(String text)
text
- the text to parse (e.g. "-0500")IllegalArgumentException
- if the text cannot be parsedpublic static UtcOffset parse(TimeZone timezone)
TimeZone
object.timezone
- the timezonepublic int getHour()
public int getMinute()
public String toString()
public String toString(boolean extended)
extended
- true to use extended format (e.g. "-05:00"), false to use
basic format (e.g. "-0500")This software is published under the BSD license. Copyright © 2003-${build.year}, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.