Calculating the duration of travel to international countries

I would like to calculate the allowance for a consultant traveling to foreign countries. I must take into account that I may gain a day or lose a day when traveling to an international country. Different countries have a different set of benefits.

How can I tweak my code to see if I get the day or lose and tune in my calculations?

0


source to share


1 answer


Enter dates / times using local time zone information. Convert from that timezone to UTC for both dates / times and calculate the difference between them based on UTC.

For example:

Left: 11/11/2008 10AM CST (Chicago) == 11/11/2008 4PM UTC (-6)



Arrived: 11/12/2008 5AM CET (Copenhagen) == 11/12/2008 4AM UTC (+1)

Difference = 12 hours

+2


source







All Articles