The list of methods to do TimeZone Usage are organized into topic(s).
TimeZone
buildTimezone(int hours, int minutes) Builds a timezone object with the given offset.
int hourMillis = 1000 * 60 * 60 * hours;
int minuteMillis = 1000 * 60 * minutes;
if (hours < 0) {
minuteMillis *= -1;
return new SimpleTimeZone(hourMillis + minuteMillis, "");
String
createPostgresTimeZone() Convert Java time zone to postgres time zone.
String tz = TimeZone.getDefault().getID();
if (tz.length() <= 3 || !tz.startsWith("GMT")) {
return tz;
char sign = tz.charAt(3);
String start;
if (sign == '+') {
start = "GMT-";
...
Date
datePlusDays(Date date, int days) date Plus Days
Calendar calendar = getMoscowCalendar();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, days);
return calendar.getTime();
TimeZone
findTimeZoneInDate(String date) find Time Zone In Date
StringBuilder sb = new StringBuilder();
StringBuilder dateBuilder = new StringBuilder(date.trim()).reverse();
int index = 0;
char c;
while ((c = dateBuilder.charAt(index++)) != ' ') {
sb.append(c);
TimeZone timezone = TimeZone.getTimeZone(sb.reverse().toString());
...
boolean
isInEasternEightZones() is In Eastern Eight Zones
boolean defaultVaule = true;
if (TimeZone.getDefault() == TimeZone.getTimeZone("GMT+08"))
defaultVaule = true;
else
defaultVaule = false;
return defaultVaule;
boolean
isKeepTimeZone(TimeZone tz) is Keep Time Zone
if (tz.getID().startsWith("Africa")) {
return true;
} else if (tz.getID().startsWith("America")) {
return true;
} else if (tz.getID().startsWith("Antarctica")) {
return true;
} else if (tz.getID().startsWith("Asia")) {
return true;
...