Converting Date and Time between Timezones

Learn to convert a given date-time object from one timezone to another timezone. We will see the examples using ZonedDateTime, Date and Calendar classes.

1. Changing Timezones of ZonedDateTime

In Java 8, date and time with timezone information is represented with ZonedDateTime. To convert a ZonedDateTime instance from one timezone to another, follow the two steps:

  • Create ZonedDateTime in 1st timezone. You may already have it in your application.
  • Convert the first ZonedDateTime in second timezone using withZoneSameInstant() method.
ZonedDateTime instant =;

ZonedDateTime instantInUTC = instant.withZoneSameInstant(ZoneId.of("UTC"));

Program Output.


Read More: Convert Date to EST/EDT Timezone

2. Changing Timezones of OffsetDateTime

Similar to ZonedDateTime, OffsetDateTime also represents an instant in universal timeline with an offset from UTC/Greenwich in the ISO-8601 calendar system. To convert a OffsetDateTime instance from one timezone to another, follow the two steps:

  • Create OffsetDateTime in 1st timezone. You may already have it in your application.
  • Convert the first OffsetDateTime in second timezone using withOffsetSameInstant() method.
OffsetDateTime now =;

OffsetDateTime nowInUTC = now.withOffsetSameInstant(ZoneOffset.of( "00:00" ));

Program Output.


3. Changing Timezones of java.util.Date

  • java.util.Date represents a time instant without timezone information.
  • It only represents the total time since the epoch in milliseconds.
  • This is very important to understand that, by default, if we print the Date object, it will always print the date and time information along with the system’s current timezone. This is misleading behavior because it suggests that Date objects can have timezone information, which is incorrect.

The correct way to deal with Date instance in different timezones is to print the date information in other timezones using the SimpleDateFormat class. It is not a good solution to adjust the instant in the timeline by adjusting the zone offset in the milliseconds of Date object.

SimpleDateFormat FORMATTER = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mma z");

//In Default Timezone
Date currentDate = new Date();

//Date in current timezone

//In UTC Timezone
TimeZone utcTimeZone = TimeZone.getTimeZone("UTC");
String sDateInUTC = FORMATTER.format(currentDate);

Program Output.

02/16/2022 at 06:36pm IST
02/16/2022 at 01:06pm UTC

Happy Learning !!

Sourcecode on Github


Notify of
Inline Feedbacks
View all comments

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.