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;
49 java.util.TimeZone zone = java.util.TimeZone.getTimeZone(timeZoneId);
50 int offset = zone.getRawOffset() / 1000;
51 int hour = offset / 3600;
52 int min = Math.abs((offset % 3600) / 60);
54 DateFormat dfm =
new SimpleDateFormat(
"z");
55 dfm.setTimeZone(zone);
56 boolean hasDaylight = zone.useDaylightTime();
57 String first = dfm.format(
new GregorianCalendar(2010, 1, 1).getTime()).substring(0, 3);
58 String second = dfm.format(
new GregorianCalendar(2011, 6, 6).getTime()).substring(0, 3);
60 String result = first + Integer.toString(mid);
62 result = result +
":" + Integer.toString(min);
79 int offset = timeZone.getRawOffset() / 1000;
80 int hour = offset / 3600;
81 int minutes = Math.abs((offset % 3600) / 60);
83 return String.format(
"(GMT%+d:%02d) %s", hour, minutes, timeZone.getID());
93 List<TimeZone> timeZoneList =
new ArrayList<>();
95 String[] ids = SimpleTimeZone.getAvailableIDs();
96 for (String
id : ids) {
106 timeZoneList.add(TimeZone.getTimeZone(
id));
112 Collections.sort(timeZoneList,
new Comparator<TimeZone>() {
114 public int compare(TimeZone o1, TimeZone o2) {
115 int offsetDelta = Integer.compare(o1.getRawOffset(), o2.getRawOffset());
117 if (offsetDelta == 0) {
118 return o1.getID().compareToIgnoreCase(o2.getID());
129 List<String> outputList =
new ArrayList<>();
131 for (TimeZone timeZone : timeZoneList) {
146 return TimeUtilities.epochToTime(epochTime,
getTimeZone());
158 return TimeUtilities.epochToTimeISO8601(epochTime,
getTimeZone());
168 return TimeZone.getDefault();
static List< String > createTimeZoneList()
static String getFormattedTime(long epochTime)
static String createTimeZoneString(TimeZone timeZone)
static String getFormattedTimeISO8601(long epochTime)
static String getTimeZoneForDisplays()
static String convertToAlphaNumericFormat(String timeZoneId)
static TimeZone getTimeZone()
static boolean displayTimesInLocalTime()