comparing dates

This is a discussion on "comparing dates" within the Classic ASP section. This forum, and the thread "comparing dates are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 27th, 2004, 20:05
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
comparing dates

how can i see if one date (thisdate) is before or after todays date (today)? can i use:

Code: Select all
if thisdate < today
....
and if so, which way round do i have to put the < for if thisdate is before today?

  #2 (permalink)  
Old Aug 27th, 2004, 21:11
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,951
Blog Entries: 7
Thanks: 7
Thanked 3 Times in 3 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
use this:-
Code: Select all
if (cdate(thisdate)) < now()
The cDate function, converts a string to a date.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #3 (permalink)  
Old Aug 28th, 2004, 09:57
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
ok thanks...
  #4 (permalink)  
Old Aug 28th, 2004, 12:39
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
ok i get an error now...

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'cdate'
/ss/calendarhome.asp, line 226

but this is my code (RSgetall is a record set of the records in a database, edate is a text field with a date in it (in mm/dd/yy format)):

Code: Select all
thisdate = formatdatetime(RSgetall("edate").value,vbLongDate)
if (cdate(thisdate)) < Now() Then

'code in here

End if
  #5 (permalink)  
Old Aug 29th, 2004, 08:49
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,951
Blog Entries: 7
Thanks: 7
Thanked 3 Times in 3 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
remove this from your code:-
Code: Select all
thisdate = formatdatetime(RSgetall("edate").value,vbLongDate)
... or put it after the cdate line.
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #6 (permalink)  
Old Aug 29th, 2004, 09:23
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to benbacardi Send a message via Skype™ to benbacardi
thanks rob, it worked a treat
Closed Thread

Tags
comparing, dates

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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP dates simonb PHP Forum 11 Sep 5th, 2007 14:30
Comparing two large XML files joeandersen Other Programming Languages 1 Jul 28th, 2006 07:21
GROUP BY and dates in SQL (again) spinal007 Databases 4 Dec 13th, 2004 17:26
dates in SQL spinal007 Databases 3 Nov 10th, 2004 09:32
dates benbacardi Classic ASP 2 Sep 14th, 2004 16:18


All times are GMT. The time now is 20:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43