Link to home
Start Free TrialLog in
Avatar of bschwarting
bschwarting

asked on

asp sql syntax - current date- datediff

What's the best way to get the current date in this query instead of the hard coded 10/15/2007?

I've tried a couple scenarios with no luck.  <%response.write(date())%> and (date())

conn.open "SELECT id, date1, EmpName, Software, Hardware, Comments, Status, date2, Comments2, Tech, Priority, DATEDIFF('d', date2, '10/15/2007') AS testouput FROM helpdesk WHERE (Status = 'closed') AND (DATEDIFF('d', date2, '10/15/2007') < " & daysback & " ) ORDER BY id DESC;", "DSN=helpdesk"

ideas?
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chisholmd
chisholmd

if this is ms sql use getdate()

eg.
DATEDIFF('d', date2, getdate())
Avatar of bschwarting

ASKER

Date() worked great, thanks!