T
TofuTheGreat
I did a group search and found hundreds of cases of problems with
DateDiff(). I read through several dozen but they didn not apply to
my situation. Not having the time to read through all of them I'm
hoping that I'll get an answer here.
The software scenario. IIS 5.0 running on Windows Server 2000. The
application is a campsite reservation system. The application starts
with a simple HTML form that people enter an arrival date and a
departure date. These two values are passed to the next page where I
want to return the sites that are open between those two dates.
Simple enough and DateDiff("d", ArrivalDate, DepartureDate) should
return what I want.
But it doesn't.
If I enter May 2nd, 2007 into the form (i.e. 5/2/2007) as the arrival
date and May 19th, 2007 (5/19/2007) as the departure date I don't get
17 days as the returned value. I get a date as if I'd entered
February 5th to May 19th and 103 days is the result returned.
I've double-checked the regional date settings on the server and they
are set for US (m/d/yyyy).
Here's a snippet of the code that I'm using:
Major PITA going on here.
DateDiff(). I read through several dozen but they didn not apply to
my situation. Not having the time to read through all of them I'm
hoping that I'll get an answer here.
The software scenario. IIS 5.0 running on Windows Server 2000. The
application is a campsite reservation system. The application starts
with a simple HTML form that people enter an arrival date and a
departure date. These two values are passed to the next page where I
want to return the sites that are open between those two dates.
Simple enough and DateDiff("d", ArrivalDate, DepartureDate) should
return what I want.
But it doesn't.
If I enter May 2nd, 2007 into the form (i.e. 5/2/2007) as the arrival
date and May 19th, 2007 (5/19/2007) as the departure date I don't get
17 days as the returned value. I get a date as if I'd entered
February 5th to May 19th and 103 days is the result returned.
I've double-checked the regional date settings on the server and they
are set for US (m/d/yyyy).
Here's a snippet of the code that I'm using:
Code:
dim ArrivalDate, DepartureDate, NumNights
ArrivalDate = request.form("txtArrivalDate")
DepartureDate = request.form("txtDepartureDate")
NumNights = Datediff("d", cdate(ArrivalDate),cdate(DepartureDate))
Major PITA going on here.