Please keep in mind when you read this post that I am a total noob when it comes to coding.
Coding in ASP
On MS Server
SQL Database/Table
I know this topic has been covered many times and many ways. In fact I've tried to use one version or another of 20 examples with no success. All I am trying to do is determine the timespan between the date a sql record was submitted and the current date.
Most of the examples I have tried to massage into my asp page have stopped the page from loading. The example I have included below does let my page load and shows my date variables and allows the subtraction to work. However, I end up with a number with a lot of decimal places after it.
I have included my code below and the output from my code. I realize it is very simple coding but I was trying to avoid having a big block of code that I don't understand. As silly as it may seem to you pros I have spent an unbelievable amount of time trying to make this work so any assistance would be greatly appreciated!!!! I have no hair left to pull out!
I'm trying to get to a point where the output displays the amount of days(if over 24 hrs) and the amount of hours.
Do I need to convert that number somehow or am I doing something completely wrong?
Expand|Select|Wrap|Line Numbers
- Dim StartTime
- Dim EndTime
- StartTime = rs("LastUpdated") 'record in sql table stored as datetime
- EndTime = (Now) 'current date
- response.write starttime & "<br>"
- response.write endtime & "<br><br>"
- Dim diff1
- diff1 = EndTime - StartTime
- Response.Write diff1
3/12/2008 11:11:53 AM
3/13/2008 12:15:11 PM
1.04395833332819
[/Output]
Please help!!