|
Home > Archive > IIS ASP > August 2004 > Date Problem
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| I am trying to compare a date in my database to the current date. My SQL
statement is:
sqltemp5="select * from users where dateclosed <= '" & date & "'"
What I am trying to accomplish is exclude records where the dateclosed field
is older than todays date. Such as if dateclosed = 6/30/2004 then today
being 08/25/2004 that record should be excluded.
Any help?
| |
| Evertjan. 2004-08-25, 5:58 pm |
| Jay wrote on 25 aug 2004 in microsoft.public.inetserver.asp.general:
> I am trying to compare a date in my database to the current date. My
> SQL statement is:
>
> sqltemp5="select * from users where dateclosed <= '" & date & "'"
>
> What I am trying to accomplish is exclude records where the dateclosed
> field is older than todays date. Such as if dateclosed = 6/30/2004
> then today being 08/25/2004 that record should be excluded.
>
Depending on the type of data base and data base connection, which you
really should state with such question, usually a date in SQL has to be
enclosed in #..# and should be in the form of yy/mm/dd so:
date = "2004/08/25"
sqltemp5="select * from users where dateclosed <= #" & date & "#"
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)
| |
| Aaron [SQL Server MVP] 2004-08-25, 5:58 pm |
| > enclosed in #..# and should be in the form of yy/mm/dd so:
>
> date = "2004/08/25"
I don't believe this is a safe format.
For Access, use #yyyy-mm-dd#
For SQL Server, use 'yyyymmdd'
Anything else can be subject to ambiguity due to locale, language, regional
settings, etc.
--
http://www.aspfaq.com/
(Reverse address to reply.)
|
|
|
|
|