Package org.openmeetings.timezone

Source Code of org.openmeetings.timezone.GetIds

package org.openmeetings.timezone;

import java.util.Calendar;
import java.util.TimeZone;

import junit.framework.TestCase;

public class GetIds extends TestCase {
 
  public GetIds(String testname){
    super(testname);
  }
 
  public void testGetIds() {
    try {
     
      String[] ids = TimeZone.getAvailableIDs();
        for (String id : ids) {
         
          TimeZone timeZone = TimeZone.getTimeZone(id);
          //TimeZone timeZone = timeRegistry.getTimeZone(id);
         
          Calendar cal = Calendar.getInstance();
        cal.setTimeZone(timeZone);
        // + cal.get(Calendar.DST_OFFSET)
        int offset = cal.get(Calendar.ZONE_OFFSET);
         
        int offsetInHours = offset/1000/60;
       
        System.out.println("<name>" + id + "</name><offset>"+offsetInHours+"</offset>");
        }
     
    } catch (Exception err) {
      err.printStackTrace();
    }
  }

}
TOP

Related Classes of org.openmeetings.timezone.GetIds

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.