List of utility methods to do Timezone Change
Date | serverTimeStringToLocalDateTime( String serverTimeString, String serverTimeFormat) server Time String To Local Date Time if (serverTimeString.equals("") || serverTimeString.equals(null)) { return null; SimpleDateFormat sd = new SimpleDateFormat(serverTimeFormat); sd.setTimeZone(TimeZone.getTimeZone("UTC")); Calendar localCal = Calendar.getInstance(); Date date = new Date(); try { ... |
String | localDateTimeToServerTimeString( Date localDateTime, String serverTimeFormat) local Date Time To Server Time String if (localDateTime == null) { return null; Calendar localCal = Calendar.getInstance(TimeZone .getTimeZone("GMT+00:00")); localCal.setTime(localDateTime); SimpleDateFormat sd = new SimpleDateFormat(serverTimeFormat); sd.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); ... |
Calendar | getLocalCalendar() get Local Calendar Calendar localCalendar = Calendar.getInstance(TimeZone
.getTimeZone(TIMEZONE_CN));
return localCalendar;
|