19 package org.sleuthkit.autopsy.coreutils;
21 import java.text.DateFormat;
22 import java.text.SimpleDateFormat;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.Comparator;
26 import java.util.GregorianCalendar;
27 import java.util.List;
28 import java.util.SimpleTimeZone;
29 import java.util.TimeZone;
47 java.util.TimeZone zone = java.util.TimeZone.getTimeZone(timeZoneId);
48 int offset = zone.getRawOffset() / 1000;
49 int hour = offset / 3600;
50 int min = Math.abs((offset % 3600) / 60);
52 DateFormat dfm =
new SimpleDateFormat(
"z");
53 dfm.setTimeZone(zone);
54 boolean hasDaylight = zone.useDaylightTime();
55 String first = dfm.format(
new GregorianCalendar(2010, 1, 1).getTime()).substring(0, 3);
56 String second = dfm.format(
new GregorianCalendar(2011, 6, 6).getTime()).substring(0, 3);
58 String result = first + Integer.toString(mid);
60 result = result +
":" + Integer.toString(min);
77 int offset = timeZone.getRawOffset() / 1000;
78 int hour = offset / 3600;
79 int minutes = Math.abs((offset % 3600) / 60);
81 return String.format(
"(GMT%+d:%02d) %s", hour, minutes, timeZone.getID());
91 List<TimeZone> timeZoneList =
new ArrayList<>();
93 String[] ids = SimpleTimeZone.getAvailableIDs();
94 for (String
id : ids) {
104 timeZoneList.add(TimeZone.getTimeZone(
id));
110 Collections.sort(timeZoneList,
new Comparator<TimeZone>(){
112 public int compare(TimeZone o1, TimeZone o2){
113 int offsetDelta = Integer.compare(o1.getRawOffset(), o2.getRawOffset());
115 if (offsetDelta == 0) {
116 return o1.getID().compareToIgnoreCase(o2.getID());
127 List<String> outputList =
new ArrayList<>();
129 for (TimeZone timeZone : timeZoneList) {
static List< String > createTimeZoneList()
static String createTimeZoneString(TimeZone timeZone)
static String convertToAlphaNumericFormat(String timeZoneId)