top_left top_right
bottom_left
Next Event: Unknown | Forum Rules | QGL Website | Event Registration
openFolder AusForums.com
iconwatfolderLineopenFolder LANs
iconwatfolderLineopenFolder QGL
iconwatfolderLineopenFolder QGL Forum
Author
Topic: visual basic date compare
diese1
Posts: 137
Location: Brisbane, Queensland
For some odd reason i can't seem to compare dates with operators less than or equal to etc.

See line of code below:

dim offCycleEndDate

If Date < 14 / 2 / 2008 Then
If Date > 30 / 1 / 2008 Then
offCycleEndDate = "717"
End If
End If


Even though todays date is the 13th it still doesn't go through the IF statemnet.

Help someone?
system
--
Opec
Posts: 4929
Location: Brisbane, Queensland
You shouldn't do that anyway.

You should use DateDiff function instead.
Jim
Posts: 7339
Location: Brisbane, Queensland
I don't know anything about vb, but is that unquoted string seriously the format you can use for a date comparison?

and if your intention is definitely to find dates between 30/01/08 and 14/2/08 wouldn't you just use a single if statement?
diese1
Posts: 138
Location: Brisbane, Queensland
cool thx, using the Datediff function now
Hogfather
Posts: 1578
Location: Cairns, Queensland
Dear world,

Please let VBScript die already.

TIA,

Us.
mooby
Posts: 3840
Location: UK
my tips for dates.

always use iso 8601 yyyy-mm-dd. saves alot of headaches if you use sql server.
mooby
Posts: 3841
Location: UK
I don't know anything about vb, but is that unquoted string seriously the format you can use for a date comparison?


use #2008/01/02#
system
--
Not a new post since your last visit.
New Post Since your last visit
Back To Forum
Advertise with Us | Privacy Policy | Contact Us
© Copyright 2001-2026 AusGamers Pty Ltd. ACN 093 772 242.
Hosted by Mammoth Networks - Australian VPS Hosting
Web development by Mammoth Media.