Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > compare date field to current date

Reply
Thread Tools

compare date field to current date

 
 
Michael Haas
Guest
Posts: n/a
 
      02-15-2004
Need some hwlp with comparing a date field retrieved from an access
date base to the current date. Basically I'm looking to create and if
statement like:
If strArticleDate < = Current Date then
else...

Thanks for any help or feedback
Mike
 
Reply With Quote
 
 
 
 
Tom B
Guest
Posts: n/a
 
      02-15-2004
Try using DateDiff

if DateDiff("d",strArticleDate, CurrentDate)>0 then
'whatever


"Michael Haas" <(E-Mail Removed)12.nj.us> wrote in message
news:(E-Mail Removed) om...
> Need some hwlp with comparing a date field retrieved from an access
> date base to the current date. Basically I'm looking to create and if
> statement like:
> If strArticleDate < = Current Date then
> else...
>
> Thanks for any help or feedback
> Mike



 
Reply With Quote
 
 
 
 
Mike Haas
Guest
Posts: n/a
 
      02-15-2004

I'm having a problem witht he currentdate part:
if I substitute "02/15/2004" for CurrentDate it works
Do I need to format CurrentDate? how should I decalre it?
Thanks for the help again.
Mike

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      02-15-2004
You shouldn't have to worry about formatting.

WHERE dateColumn <= Date()

or better yet, if dateColumn has time information,

WHERE dateColumn < DATEADD("d", 1, Date())

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




"Mike Haas" <(E-Mail Removed)12.nj.us> wrote in message
news:u8IyUm#(E-Mail Removed)...
>
> I'm having a problem witht he currentdate part:
> if I substitute "02/15/2004" for CurrentDate it works
> Do I need to format CurrentDate? how should I decalre it?
> Thanks for the help again.
> Mike
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
Mike Haas
Guest
Posts: n/a
 
      02-15-2004

That did the trick, thanks


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Compare access db birthday date field with date CZ ASP .Net 1 09-23-2005 04:19 AM
get today's date and compare to txt Field peashoe@yahoo.com ASP General 8 01-24-2005 08:22 PM
how to compare current date to a future date and validate it in ASP.NET James P. ASP .Net 7 07-13-2004 10:13 PM



Advertisments