The format of the DateDiff function is
DateDiff(code, date1, date2)
Code comes from the table below and indicates what unit of time you are wanting the difference measured in:
Code | Time Span |
yyyy | Year |
q | Quarter |
m | Month |
y | Day of year |
d | Day |
w | Weekday |
ww | Week of year |
h | Hour |
n | Minute |
s | Second |
The two dates are the dates which you will be comparing to each other
So to take today's date, a "Last Logon" date and see how many days it's been since your user logged onto your site, you would use:
DateDiff("d", LastLogon, Now())
Date and Time Functions
Introduction to ASP Ebook Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages. |