UTCTimeZoneShift#

public class UTCTimeZoneShift extends TimeZone#

Represents the shift, i.e. the time difference between a time zone ‘X’ and the UTC+0 time zone.

This is used for (de-)serialization of ISO8601-compliant representations of UTC-relative time zones (e.g. +0100 for CEST)

Author:

tf

Fields#

NEGATIVE#

public static final int NEGATIVE#

POSITIVE#

public static final int POSITIVE#

Constructors#

UTCTimeZoneShift#

public UTCTimeZoneShift(int sign, int h, int m)#

Methods#

equals#

public boolean equals(Object obj)#

getID#

public String getID()#

getISO8601Offset#

public static String getISO8601Offset(TimeZone timezone, long date)#

Generate an ISO 8601 time zone offset string (e.g. +0200) for the given time zone at the given date.

The date is necessary to decide whether the time zone (e.g. Europe/Berlin) is in the daylight saving regime or not. In winter Europe/Berlin has a +0100 offset, in summer it is +0200.

Parameters:
  • timezone

    • the time zone in question.

  • date

    • the date for which the offset is to be calculated (unix time stamp).

Returns:

ISO 8601 time zone offset.

getOffset#

public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds)#

getRawOffset#

public int getRawOffset()#

inDaylightTime#

public boolean inDaylightTime(Date date)#

setRawOffset#

public void setRawOffset(int offsetMillis)#

toString#

public String toString()#

ISO 8601 conform +/-hhmm.

useDaylightTime#

public boolean useDaylightTime()#