Highlighted

Time Clock

Avatar

22-07-2008

I made a time card for my company. It is very simple and calculates time and gives you a sum. It is in military time. the problem I have is when someone works till midnight. So if I enter 19:00 for a start time and 24:00 for end time, it tells me "enter time in the format 00:00" It is getting hung up on the 24:00. I have the time set for HH:MM. I tried 00:00 as well with same error.



Has anyone run into this problem?

Thanks in advance.

Replies

Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

22-07-2008

00:00 should be midnight..according to the specs valid time is 00:00 to 23:59
Highlighted
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

23-07-2008

Not without writing some sort of script
Highlighted

Avatar

23-07-2008

Here is what I have now that gives me the total for hours worked.



----- form1.#subform[0].Table1.Row1.RegHrTot1::calculate: - (FormCalc, client) ---------------------



var in1 = Time2Num(in1Mon1.formattedValue,"H:MM")

var out1 = Time2Num(out1Mon1.formattedValue,"H:MM")



if ((in1 > 0) and (out1 > 0)) then

$ = (((out1-in1)) / (60 * 60 * 1000))

endif



What do I need to add to round off quarter hours.



thanks.
Highlighted

Avatar

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692

Avatar

pguerett

Total Posts

7.7K

Likes

611

Correct Answer

692
pguerett

24-07-2008

Once you have the total number of minutes, then divide by 60 (that will be the hours), then the reminder will be the number of minutes left. Then either use a select statement or nested if statements that will tell you how to round the minutes off (i.e. if remainder <= 7 then 0 additional time, else if remainder <= 22 then 1/4 additional hour, else if remainder <= 37 then additional time = 1/2 hour, else if remainder <= 52 then additional time = 3/4 hour else additional time = 1 hr



I am not a programmer so someone out there may have a better way, but that is all that I could think of.