I need to convert from one timezone to another timezone in my project.
I am able to convert from my current timezone to another but not from a different timezone to
This is not the answer, but could help someone trying to generate dates with same timezone and apply another timezone's offset. It is useful when your application server is running in one timezone and your database in another.
public static Date toGreekTimezone (Date date) {
ZoneId greek = ZoneId.of(EUROPE_ATHENS);
ZonedDateTime greekDate = ZonedDateTime.ofInstant(date.toInstant(), greek);
ZoneId def = ZoneId.systemDefault();
ZonedDateTime defDate = greekDate.withZoneSameLocal(def);
return Date.from(defDate.toInstant());
}