DEV Community

A N M Bazlur Rahman
A N M Bazlur Rahman

Posted on • Originally published at bazlur.com on

How to calculate date and time involving time zone? doesn't have to be hard.

Calculating time with a zone was never this easy. Using the date-time API, you can calculate with timezone pretty much effortlessly.

Let’s assume we have a flight from Toronto (YYZ) to Dubai (DXB) today. The flight takes off at 21:45. The total duration of the flight is 12 hours and 45 minutes. What would be the local time when the plane lands?

The following code will allow you to calculate that easily-

100DaysOfProgramming_Day008

for copy/paste pleasure: https://github.com/rokon12/100DaysOfJava/blob/main/src/main/java/com/bazlur/Day010.java

Top comments (0)