AudiTT @ Mci
|
| Posted: 03/08/2002, 8:23 AM |
|
Hello All, and good Morning.
I have a field called Date_Approved, and End_Time. This is the start and end to an event in my application. I need to populate the field 'Duration' with a format like this..
1 Hour(s) and 30 Minutes
Any ideas. I am using ASP and MS SQL2000 and I got this to work by using DateDIF in some querys, but that wont work for the pages I want to update. It gives me and error stating I have some type of problem with a colum in the view. I think this is because my page is trying to update to the view, and I pretty much made it read only.
Thanks for the help.
Bryan.Caddy@wcom.com
|
|
|
 |
AudiTT @ Mci
|
| Posted: 03/08/2002, 9:45 AM |
|
'This is to get the diffrence for the date. BLC
Dim dtBegin, dtEnd, dtMBegin, dtMEnd
dtBegin = fldDate_Approved
dtEnd = fldEnd_Time
dtMBegin = fldDate_Approved
dtMEnd = fldEnd_Time
Dim iHourDifference
iHourDifference = DateDiff("h", dtBegin, dtEnd)
Here is what I did.
Dim iMinuteDifference
iMinuteDifference = DateDiff("n", dtMBegin, dtMEnd)
Dim MinutesLeft
MinutesLeft = (iMinuteDifference-(iHourDifference * 60))
fldDuration = iHourDifference & " Hour(s) and " & MinutesLeft & " Minutes"
'This will complete the field DurationHM. BLC
if fldEnd_Time = "" THEN
fldAllDates = "Not Defined"
else
fldAllDates = fldDate_Approved & " to " & fldEnd_Time
end if
|
|
|
 |
Andrew B
|
| Posted: 03/08/2002, 9:09 PM |
|
Didja solve it or are you still in need of help?
What exactly are you trying to update? Are you trying to let them pick a start time (like 12:00 pm) and then a duration (1 Hour(s) 30 Minutes), and the update the end time with the start time + the durration?
I am a bit confuzed :) I just did a little something like this for the site lockout thingy I did, and this is what it looked like :
iLockTime = cint(iLockTime) 'convert to an integer just in case
application("maint_timeup") = DateAdd("n", iLockTime, Now())
this adds the time to now. I also can increment the time by doing the same thing but referencing the aplicaiton variable. The same should apply for datetimes you will be inserting into sql server. The way I would say to do it is just to pass in a start time (in whatever format) and a durration (in minutes) to a SP and let it do the work :)
|
|
|
 |
|