Java: get the time of another time zone

public Date getLocalCurrentDate() {
TimeZone timeZone = TimeZone.getTimeZone(„Greece“);
TimeZone defaultZone = TimeZone.getTimeZone(„GMT“);
Date localDate = new Date();
Date yourDate = new Date();
yourDate.setTime(localDate.getTime() + timeZone.getRawOffset() – defaultZone.getRawOffset() – defaultZone.getDSTSavings());
return yourDate;
}

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert