Category Archives: Java

Getting timezone and timezone offset

String timezone = Calendar.getInstance().getTimeZone().getDisplayName(false, TimeZone.SHORT);

int timezoneOffset = 0;
Calendar myCalendar = new GregorianCalendar();
int gmtOffset = myCalendar.get(Calendar.ZONE_OFFSET);
int dstOffset = myCalendar.get(Calendar.DST_OFFSET);

timezoneOffset = gmtOffset + dstOffset;