Reply to topic
help with date comparisons please!
noodles


Joined: 12 Jul 2006
Posts: 2
Reply with quote
I have been a PHP programmer for years, but (and I mean BUT) a current client has his site hosted on a microshaft server using asp. I am reliving the horrors of programming in basic, BC7 and VB, but I must comply and try to satisfy things.

I am trying to compare the system date to a stored sate in the DB...

If avlproplist("ExpDate") < Date Then
expired = "*** EXPIRED ***"
End If

This SHOULD return an accurate response, but does not. Even if a stored date is greater than system date, the response is the same.

Anyone know how to do this? It would take maybe 1 line of code in PHP, but we're in Bill's world here so things are not as they seem.

Any help would be appreciated.
spoulson


Joined: 21 Jun 2006
Posts: 22
Location: Middletown, DE
Reply with quote
Is 'Date' a variable or are you comparing against the current date/time? If it's a variable, is it a date value or a string representing a date?

Assuming Date is an actual date value, that code block should work. Otherwise, you can convert a string to date by:

DateVar = CDate(string)

I found a page with lots of details on how VBScript handles date/time values. Check it out:
http://www.merlyn.demon.co.uk/vb-dates.htm
noodles


Joined: 12 Jul 2006
Posts: 2
Reply with quote
Thanks for the reply. I tried the following code using your suggestion:

If CDate(avlproplist("ExpDate")) < Date Then
expired = "*** EXPIRED ***"
End If

Date is the system date and avlproplist("ExpDate") pulls the date/time variable from the database. but the above still results in every date being EXPIRED, when some are actually future dates.

What I'm trying to accomplish is to pull all dates from the database of home listings and check for all expired listings, then mark them accordingly.
help with date comparisons please!
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic