In order to get the Date in Java for a specific TimeZone, you can make use of the LocalDate class from the Date-Time API and pass in the ZoneId for the timezone in the static now method.
Example:
import java.time.LocalDate;
import java.time.ZoneId;
public class GetDateTimeZoned {
public static void main(String[] args) {
LocalDate dateInChicago = LocalDate.now(ZoneId.of("America/Chicago"));
LocalDate dateInMumbai = LocalDate.now(ZoneId.of("Asia/Kolkata"));
LocalDate dateInTokyo = LocalDate.now(ZoneId.of("Asia/Tokyo"));
LocalDate dateInLondon = LocalDate.now(ZoneId.of("Europe/London"));
System.out.println("Date in Chicago " + dateInChicago);
System.out.println("Date in Mumbai: " + dateInMumbai);
System.out.println("Date in Tokyo: " + dateInTokyo);
System.out.println("Date in London: " + dateInLondon);
}
}
Output:

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!