calculate total time "Access"
-
i am creating a report with Access, i want to calculate the total time spend for example x =Sum([Serv_Rec_Time_Spent]) x is 23:30 H for example, if i add 2 hours then x = 1:30 , instead of 25:30 hours please i need help ASAP
in .net you can accomplish this pretty simply using the timespan structure.
Dim startTime As DateTime Dim endTime As DateTime Dim duration As TimeSpan startTime = DateTime.Now '--- code to generate your report, or any other process you want to time ---' endTime = DateTime.Now duration = endTime.Subtract(startTime)
hope this helps,
-jim
-
in .net you can accomplish this pretty simply using the timespan structure.
Dim startTime As DateTime Dim endTime As DateTime Dim duration As TimeSpan startTime = DateTime.Now '--- code to generate your report, or any other process you want to time ---' endTime = DateTime.Now duration = endTime.Subtract(startTime)
hope this helps,
-jim
Well I am not calculating starting time and end time For example I have 10 textbox each one has a different time I just want to add them up so the total will not round up. 20:00 hours Plus 6:00 the total hours should be 26:00, But coz it's time Elapsed, the total is 2:00 hours instead of 26:00 H
-
Well I am not calculating starting time and end time For example I have 10 textbox each one has a different time I just want to add them up so the total will not round up. 20:00 hours Plus 6:00 the total hours should be 26:00, But coz it's time Elapsed, the total is 2:00 hours instead of 26:00 H
you can still use the timespan structure for this. the only issue is that once you get above 24 hours, the hour portion of the time value is translated into a value representing a day/hour combination. in other words in your example above the resulting value would look like 1.02:00:00 meaning 1 day, 2 hours, 0 minutes, 0 seconds.
Dim timeOne As DateTime = DateTime.Parse("2004-01-14T12:00:00") Dim timeTwo As DateTime = DateTime.Parse("2004-01-14T23:00:00") Dim totalTime As TimeSpan totalTime = New TimeSpan(timeOne.TimeOfDay.Ticks + timeTwo.TimeOfDay.Ticks) messagebox.show(totaltime.tostring)
the result of this example would be 1.11:00:00 (1 day, 11 hours, 0 minutes, 0 seconds) i don't know if this will work for you or not. if you want to post some code maybe i can try to work something else out to help...
-jim