Hi All,
I need a little bit of code which allows me to count the number of days since a particular date. eg if the date is November 1, the count will display 21 (since it's the 22nd today).
Is there a quick and easy way of doing this?
use datediff to calculate the difference between the given date and the current date
syntax
DateDiff(interval, date1, date2)
Intervals are
yyyy = year
q = Quarter
m = Month
y = Day of year
d = Day
w = Weekday
ww = Week of year
h = Hour
n = Minute
s = Second
brief example
dateValue = "11/01/2002"
difference = DateDiff("d", dateValue, Now)
would return in days 21
common error (and I know because I do it all the time) is to simply place the date values in the wrong arguments. or thus backwards
hope that helps A language that doesn't affect the way you think about programming is not worth knowing.
beat me to it
see what happens when you get wordy and type too much. A language that doesn't affect the way you think about programming is not worth knowing.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.