Convert between LocalDateTime and ZonedDateTime

Learn to convert the LocalDateTime to ZonedDateTime, and vice versa using easy-to-understand Java examples.

An instance of LocalDateTime represents a date-time (to nanosecond precision.) without a time-zone in the ISO-8601 calendar system. A LocalDateTime instance represents a point in the local timeline. It cannot represent an instant on the universal timeline without additional information such as an offset or time zone.

A ZonedDateTime instance represents an instant in the universal timeline. It is the combination of date, time and zone information.

1. LocalDateTime -> ZonedDateTime

To convert from LocalDateTime to ZonedDateTime, we must add the zone offset to the local date-time. Whatever the zone information we will add, the constructed object will represent an instant in the universal timeline with the configured offset.

ZonedDateTime = LocalDateTime + ZoneId

LocalDateTime ldt =; //Local date time

ZoneId zoneId = ZoneId.of( "Asia/Kolkata" );  //Zone information

ZonedDateTime zdtAtAsia = ldt.atZone( zoneId );	//Local time in Asia timezone

ZonedDateTime zdtAtET = zdtAtAsia
    .withZoneSameInstant( ZoneId.of( "America/New_York" ) ); //Sama time in ET timezone

Program Output:


2. ZonedDateTime -> LocalDateTime

Use ZonedDateTime.toLocalDateTime() method to get local datetime without timezone information.

ZonedDateTime zdtAtET ="America/New_York"));

LocalDateTime ldt = zdtAtET.toLocalDateTime();


Program Output:


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.

Our Blogs

REST API Tutorial

Dark Mode

Dark Mode