Software Development

Java 8 – Get my current timezone using ZonedDateTime

java Sort Enum Properties Monitor Directory File Lambda Expression parameter return types Validate XML String XSD ExecutorService AutoCloseable Try-With-Resources Convert LocalDateTime OffsetDateTime Run Codes Before Shutdown XML Tag Lambda PostgreSQL JDBC invoke JavaScript Applet SFTP Batch hang block main thread MySQL JDBC try-with-resources delete Unencrypted SoapFault Apache CXF Remove XML Element XSLT skip execute finally public static void main constructor fields Eclipse convert Iterator Stream StreamSupport XMLEncoder XMLDecoder rename P6Spy JDBC Example PDF Version JasperReports Run from Ant iReport Page Numbers Count entities persistence context hibernate

This post shows how to get your current timezone in Java using ZonedDateTime class.

Get Current Timezone Using ZonedDateTime

Since Java 8, it is possible to determine your current timezone using ZoneDateTime. Suppose you are in Singapore or thereabout; the following codes display your current time zone.

When we run the codes, we get the following output.


Got comments, or suggestions? Please visit our Facebook page!

You Might Also Like