Java TimeZone Add addTimeZone(String id, double off)

Here you can find the source of addTimeZone(String id, double off)

Description

Add a java.util.SimpleTimeZone

License

Open Source License

Parameter

Parameter Description
String - identifier of time zone

Return

SimpleTimeZone

Declaration

private static SimpleTimeZone addTimeZone(String id, double off) 

Method Source Code

//package com.java2s;
/**/*from www  . ja  va2s .c om*/
 * Copyright (c) 2005, 2011, Werner Keil, Ikayzo and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Werner Keil - initial API and implementation
 */

import java.util.*;

public class Main {
    static HashMap<String, SimpleTimeZone> s_timeZoneTable = null;

    /**
     * Add a java.util.SimpleTimeZone
     * 
     * @param String
     *            - identifier of time zone
     * @param double - hours to be added to UTC to get local time (may be
     *        fractional)
     * @return SimpleTimeZone
     */
    private static SimpleTimeZone addTimeZone(String id, double off) {

        int offset = (new Double(off * 3600000)).intValue();

        SimpleTimeZone tz = new SimpleTimeZone(offset, id);

        s_timeZoneTable.put(id, tz);

        return tz;

    }
}

Related

  1. adjustTimeToDefaultTimezone(long time)
  2. baseFor(TimeZone tz)
  3. cal(TimeZone tz)
  4. isAfter(int month1, int day1, int year1, int hour1, int minute1, int amPm1, int month2, int day2, int year2, int hour2, int minute2, int amPm2, TimeZone timeZone, Locale locale)