Femto Web Server V1.4-F

dfischer.femtowebserver.lib
Class ZoneTime

java.lang.Object
  |
  +--dfischer.femtowebserver.lib.ZoneTime

public class ZoneTime
extends java.lang.Object

Library for date and time - supports time zones.

See Also:
Httpd.setTimeZone(java.lang.String)

Field Summary
static java.lang.String[] MONTH_SHORT_STRING
          Array[0..11], of (all) short month names.
static java.lang.String[] MONTH_SHORT_STRING_UPPECASE
          Array[0..11], of (all) short month names in UPPERCASE.
static java.lang.String[][] TIME_ZONE
          Array[time-zone-description 0 .. time-zone-description n-1][time-zone-ID] of all time zones.
 
Method Summary
static java.util.Date currentDate()
          Returns the current date in the time zone GMT.
static java.lang.String dateToShortString()
          Returns the current date in the default time zone as text string, formatted as "DD MMM YYYY HH:MM:SS.mmm".
static java.lang.String dateToShortString(java.util.Date date, boolean millis)
          Returns a recalculated GMT date in the default time zone as text string, formatted as "DD MMM YYYY HH:MM:SS[.mmm]".
static java.lang.String dateToShortString(java.util.Date date, java.lang.String timeZone, boolean millis)
          Returns a recalculated GMT date in the desired time zone as text string, formatted as "DD MMM YYYY HH:MM:SS[.mmm]".
static java.lang.String dateToShortString(java.lang.String timeZone, boolean millis)
          Returns the current date in the desired time zone as text string, formatted as "DD MMM YYYY HH:MM:SS[.mmm]".
static java.lang.String getDefaultTimeZone()
          Returns the default time zone ID.
static java.util.GregorianCalendar getGregorianCalendar(java.util.Date date, java.lang.String timeZone)
          Creates a calendar in a desired time zone, based on a GMT date.
static java.util.TimeZone getTimeZone(java.lang.String timeZone)
          Converts the time zone ID to a java.util.TimeZone
static void setDefaultTimeZone(java.lang.String timeZone)
          Alters the default time zone.
static java.lang.String timeZoneToFullString(java.lang.String timeZone)
          Translates a time zone ID to its specific text-description
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONTH_SHORT_STRING

public static final java.lang.String[] MONTH_SHORT_STRING
Array[0..11], of (all) short month names.
MONTH_SHORT_STRING = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};

MONTH_SHORT_STRING_UPPECASE

public static final java.lang.String[] MONTH_SHORT_STRING_UPPECASE
Array[0..11], of (all) short month names in UPPERCASE.
MONTH_SHORT_STRING_UPPECASE = {"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};

TIME_ZONE

public static final java.lang.String[][] TIME_ZONE
Array[time-zone-description 0 .. time-zone-description n-1][time-zone-ID] of all time zones.
      TIME_ZONE[][] =
		{{"(GMT -11:00) Midway-Islands, Samoa","MIT"},
		 {"(GMT -10:00) Hawaii","HST"},
		 {"(GMT -9:00)  Alaska","AST"},
		 {"(GMT -8:00)  Pacific Time (US and Canada), Tijuana","PST"},
		 {"(GMT -7:00)  Mountain Time (US and Canada)","MST"},
		 {"(GMT -7:00)  Arizona","PNT"},
		 {"(GMT -6:00)  Central Time (US and Canada)","CST"},
		 {"(GMT -5:00)  Eastern Time","EST"},
		 {"(GMT -5:00)  Bogota, Lima, Quito, Indiana","IET"},
		 {"(GMT -4:00)  Atlantic","PRT"},
		 {"(GMT -3:30)  Newfoundland","CNT"},
		 {"(GMT -3:00)  Brasil","BET"},
		 {"(GMT -1:00)  Azores, Cape Verde Islands","CAT"},
		 {"(GMT)        GMT, Casablanca, Monrovia","GMT"},
		 {"(GMT)        Dublin, Edinburg, Lissabon, London","WET"},
		 {"(GMT +1:00)  Amsterdam, Berlin, Bern, Paris, Madrid, Rom, Wien","ECT"},
		 {"(GMT +2:00)  Athen, Istambul, Helsinki","EET"},
		 {"(GMT +3:00)  Bagdad, Kuwait, Riad","EAT"},
		 {"(GMT +3:30)  Teheran","MET"},
		 {"(GMT +4:00)  Abu Dhabi, Tiflis","NET"},
		 {"(GMT +5:00)  Islamabad, Karachi","PLT"},
		 {"(GMT +5:30)  New-Dehlhi, Bombay, Calcutta","IST"},
		 {"(GMT +6:00)  Dakka, Colombo","BST"},
		 {"(GMT +7:00)  Bangkok, Hanoi, Jakarta","VST"},
		 {"(GMT +8:00)  Peking, Hongkong","CTT"},
		 {"(GMT +9:00)  Osaka, Sapporor, Tokio","JST"},
		 {"(GMT +9:30)  Darwin","ACT"},
		 {"(GMT +10:00) Canberra, Melbourne, Sydney","AET"},
		 {"(GMT +11:00) Salomon-Islands","SST"},
		 {"(GMT +12:00) Auckland, Wellington","NST"}};
		
Method Detail

setDefaultTimeZone

public static void setDefaultTimeZone(java.lang.String timeZone)
Alters the default time zone. The pre-configured value is "ECT".
Parameters:
timeZone - time zone ID

getDefaultTimeZone

public static java.lang.String getDefaultTimeZone()
Returns the default time zone ID.
Returns:
default time zone ID

getTimeZone

public static java.util.TimeZone getTimeZone(java.lang.String timeZone)
Converts the time zone ID to a java.util.TimeZone
Parameters:
timeZone - time zone ID
Returns:
java.util.TimeZone equivalent java.util.TimeZone

timeZoneToFullString

public static java.lang.String timeZoneToFullString(java.lang.String timeZone)
Translates a time zone ID to its specific text-description
Parameters:
time - zone ID
Returns:
text-description of time zone

currentDate

public static java.util.Date currentDate()
Returns the current date in the time zone GMT.
Returns:
current date in the time zone GMT

getGregorianCalendar

public static java.util.GregorianCalendar getGregorianCalendar(java.util.Date date,
                                                               java.lang.String timeZone)
Creates a calendar in a desired time zone, based on a GMT date.
Parameters:
date - date in the time zone GMT
timeZone - desired time zone of calendar
Returns:
time zone specific calendar
See Also:
currentDate()

dateToShortString

public static java.lang.String dateToShortString()
Returns the current date in the default time zone as text string, formatted as "DD MMM YYYY HH:MM:SS.mmm".
Returns:
current date in the default time zone as text string
See Also:
setDefaultTimeZone(java.lang.String)

dateToShortString

public static java.lang.String dateToShortString(java.lang.String timeZone,
                                                 boolean millis)
Returns the current date in the desired time zone as text string, formatted as "DD MMM YYYY HH:MM:SS[.mmm]".
Parameters:
timeZone - time zone ID of desired time zone
millis - flag: if true, the result text string contains also milliseconds
Returns:
current date in the desired time zone as text string

dateToShortString

public static java.lang.String dateToShortString(java.util.Date date,
                                                 boolean millis)
Returns a recalculated GMT date in the default time zone as text string, formatted as "DD MMM YYYY HH:MM:SS[.mmm]".
Parameters:
date - date in the time zone GMT
millis - flag: if true, the result text string contains also milliseconds
Returns:
recalculated date of current time zone as text string
See Also:
currentDate(), setDefaultTimeZone(java.lang.String)

dateToShortString

public static java.lang.String dateToShortString(java.util.Date date,
                                                 java.lang.String timeZone,
                                                 boolean millis)
Returns a recalculated GMT date in the desired time zone as text string, formatted as "DD MMM YYYY HH:MM:SS[.mmm]".
Parameters:
date - date in the time zone GMT
timeZone - time zone ID of desired time zone
millis - flag: if true, the result text string contains also milliseconds
Returns:
recalculated date of desired time zone as text string
See Also:
currentDate()

Femto Web Server V1.4-F

Copyright 2002, 2003, 2006 by Ingenieurbüro David Fischer GmbH, Switzerland. All rights reserved.