Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date comparisons

Status
Not open for further replies.

cleavitt

Programmer
Jun 25, 2002
3
CA
Is there some way of comparing 2 dates in vbscript to tell which one comes first?

Any tips would be greatly appreciated!
 
<script language=&quot;VBscript&quot;>
Dim one, two
one = DateValue(#10/5/97#)
two = DateValue(#10/7/98#)
if Year(one)>Year(two) then
myVar = msgbox(&quot;one is before two&quot;)
elseif day(one)>day(two) then
myVar = msgbox(&quot;one is before two&quot;)
else
myVar = msgbox(&quot;two is before one&quot;)
end if
</script> I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
JohnYingling
it was just a example of a way I determined a while ago which date was teh earliest per year value. I guess I just assumed the year thing would be changed to satify the needs here. [bomb]
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top