Robbie3003
New member
- Local time
- Today, 19:08
- Joined
- Feb 14, 2014
- Messages
- 3
I have a website that has 9 time boxes, each box is for the user to report that actual time they did something. Some of those times are then used to calculate the total time a certain operation took.
In access I have the times stored in date/time format using shorttime and I am adding these values together
The code I cobbled up is below
timetotal1: IIf([time9]=#00:00:00# And [time3a]>#00:00:00#,Format(((CLng(24*60*CDate([time3a]))-CLng(24*60*CDate([time3]))))\60,"0") & ":" & Format(((CLng(24*60*CDate([time3a]))-CLng(24*60*CDate([time3])))) Mod 60,"00"),IIf([time9]=#00:00:00#,Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5]))))\60,"0") & ":" & Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5])))) Mod 60,"00"),Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5])))+(CLng(24*60*CDate([time9]))-CLng(24*60*CDate([time8]))))\60,"0") & ":" & Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5])))+(CLng(24*60*CDate([time9]))-CLng(24*60*CDate([time8])))) Mod 60,"00")))
In simple terms if box one was 09.00 and box two was 10.00 the difference between the two is 01.00 this time is then added to the difference between the other boxes and the total output is the total time I am looking for
Even though I suspect the code above it way over the top it works exactly as I wanted, except..........
if box one the job started at 23.30 and box two the job finished 01.30 it all goes wrong and I get minus outputs which the next web page can't process and it all crashes.
All I need to do is cater for this and I am done
Can anyone point me in the right direction please
Many thanks in advance
Rob
PS I hope I made sense
In access I have the times stored in date/time format using shorttime and I am adding these values together
The code I cobbled up is below
timetotal1: IIf([time9]=#00:00:00# And [time3a]>#00:00:00#,Format(((CLng(24*60*CDate([time3a]))-CLng(24*60*CDate([time3]))))\60,"0") & ":" & Format(((CLng(24*60*CDate([time3a]))-CLng(24*60*CDate([time3])))) Mod 60,"00"),IIf([time9]=#00:00:00#,Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5]))))\60,"0") & ":" & Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5])))) Mod 60,"00"),Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5])))+(CLng(24*60*CDate([time9]))-CLng(24*60*CDate([time8]))))\60,"0") & ":" & Format(((CLng(24*60*CDate([time4]))-CLng(24*60*CDate([time3])))+(CLng(24*60*CDate([time6]))-CLng(24*60*CDate([time5])))+(CLng(24*60*CDate([time9]))-CLng(24*60*CDate([time8])))) Mod 60,"00")))
In simple terms if box one was 09.00 and box two was 10.00 the difference between the two is 01.00 this time is then added to the difference between the other boxes and the total output is the total time I am looking for
Even though I suspect the code above it way over the top it works exactly as I wanted, except..........
if box one the job started at 23.30 and box two the job finished 01.30 it all goes wrong and I get minus outputs which the next web page can't process and it all crashes.
All I need to do is cater for this and I am done
Can anyone point me in the right direction please
Many thanks in advance
Rob
PS I hope I made sense
Last edited: