Date Problem
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > IIS server support > IIS ASP > Date Problem




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Date Problem  
Jay


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-25-04 10:58 PM

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?








[ Post a follow-up to this message ]



    Re: Date Problem  
Evertjan.


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-25-04 10: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)






[ Post a follow-up to this message ]



    Re: Date Problem  
Aaron [SQL Server MVP]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-25-04 10: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.)







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:35 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register