Quantcast
Channel: Adobe Community : All Content - ASP VBScript Development (read only)
Viewing all articles
Browse latest Browse all 106

Trouble with DateDiff function and date from Recordset

$
0
0

Hi.  I'm trying to use the following wee function to calculate the number of hours from a smalldatetime value in my recordset and the current date/time (Now()).  I'm using ASP VBScript.

 

I was recommended the following function:

 

<%
    timeStart = "2009/10/10 12:14:00"

    Response.Write(datediff("h", timeStart, Now()))
%>

 

How do I change the static date value to one from my recordset?

I've tried adding in the code like this:

<%
    timeStart = "(rsLATESTREVIEWS.Fields.Item("mgreviewdate").Value)"

    Response.Write(datediff("h", timeStart, Now()))
%>

 

I also tried this:

<%
    timeStart = "(rsLATESTREVIEWS.Fields.Item(" & " mgreviewdate " & ").Value)"

    Response.Write(datediff("h", timeStart, Now()))
%>

 

...but I'm getting lots of "Expected end of statement" errors with both.

 

Would appreciate any advice. Thanks.

Regards
Nath.


Viewing all articles
Browse latest Browse all 106

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>