Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Timecalc.prg
Message
From
23/01/2002 16:28:29
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Timecalc.prg
Miscellaneous
Thread ID:
00609326
Message ID:
00609326
Views:
47
Hi,

I need to do some calculations based on time. For example, someone clocks in at 06:00:00 and clocks out at 16:35:00 I need to find out how many hours and minutes they worked that day. I searched on the Microsoft Knowledge Base and found a prg called timecalc. (http://support.microsoft.com/default.aspx?scid=kb;en-us;Q115055)

I tried it out, and I am not sure if its just me - but it seems to be doing wierd things. I looked at the code behind and it makes sense to me so I don't know whats going one.

MESSAGEBOX(timecalc("21:51:00", "21:00:00:", 2))
returned 0 hours and 9 minutes.

if I tried it the other way
MESSAGEBOX(timecalc("21:00:00", "21:51:00:", 2))
returned 0 hours 51 minutes. (correct)

But if I tried
MESSAGEBOX(timecalc("06:00:00","16:35:00" , 2))
returns 10 hours and 35 minutes - this is wrong, it should be 10 hour and 25 minutes

the other way
MESSAGEBOX(timecalc("16:35:00","06:00:00" , 2))
returns - 10 hours and 25 minutes

So after looking at timecalc.prg the code made sense and I am not sure why I am getting these results. I have been spending lots of time on this project I am working on lately so maybe I am just missing something very simple.

Anyways, is there a better, more reliable way to do what I want to do? Using vfp 7

Thanks!
Chris
Next
Reply
Map
View

Click here to load this message in the networking platform