47. Calculating duration

Write a program that lets the user select two dates and times. When the user presses a button, the program should calculate the time between the selected times in hours. It should then convert the times into UTC times and repeat the calculation.

Test the program by verifying that the time between 1:00 PM March 7, 2020 and 1:00 PM March 8, 2020 is 23 hours because Daylight Saving Time starts at 2:00 AM on March 8, 2020.

If your computer isn't localized to use Daylight Saving Time, use times that span the beginning of Summer Time or whatever other time change your locale observes. If your locale doesn't change the clocks, consider yourself lucky and try converting the local times to Easter Standard Time for testing.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset