This topic is locked

Calculating time fields

12/22/2005 5:18:20 PM
ASPRunnerPro General questions
J
joeM author

I'm trying to get a timesheet application working (and will gladly submit it to the HowTo's when done). Here is the SQL for the fields:
select [TimesheetID],

[Employee],

[Client],

[Project],

[Description],

[Rate],

[Date],

[TimeOn],

[TimeOff],

[TotalTime],

[TotalBillable]

From [Timesheet]
I want the fields [TimeOn] and [TimeOff] to actually be times using the Now() function and have the field [TotalTime] be a calculation. I'm not sure how to make a time such as 8:00AM and 5:00PM convert into 9 hours via SQL to get the field [TotalTime] filled correctly.
I'd like the total time multiply with the rate to make a total billable calculation.
Select

[TimeTime] * [Rate] = [TotalBillable] From [Timesheet]
Any help would be greatly appreciated! Thanks in advance.

Sergey Kornilov admin 12/23/2005

Try somethinsg like this:

select [TimesheetID],

[Employee],

[Client],

[Project],

[Description],

[Rate],

[Date],

[TimeOn],

[TimeOff],

DateDiff("h", TimeOn, TimeOff) as [TotalTime],

[TimeTime] * [Rate] as [TotalBillable],

From [Timesheet]