Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Time difference between work times
Message
From
20/05/2002 07:19:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00658718
Message ID:
00658800
Views:
39
>Hello all,
>
>Has anyone worked with calculating time differences between actual work hours, for example, the minutes expired between days, but only between 9am - 5pm?
>
>I have resorted to putting the two times in a loop and adding the difference in 15 minutes increments, but it seems inefficient for several day spans.
>
>Hopefully this makes sense, if not, let me know and I'll explain more..
>
>AHIGA,
>Ed

Example: 10 a.m. (Jan. 2, 2002) - 3 p.m. (Jan 6, 2002)

First, calculate all integer days (Jan. 4 - Jan. 5) - that would be 2 days x 8 hours/day x 3600 seconds/hour.

Now, calculate seconds elapsed on Jan. 2: datetime(2002, 1, 2, 17) - datetime(2002,1, 2, 10).

Do a similar calculation for Jan. 6.

Add everything up (result is in seconds). Convert to minutes and hours, as needed.

HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform