Article View: alt.comp.lang.visualbasic.ver3
Article #65Re: Comparing date
From: Johan Bechthum
Date: Wed, 16 Aug 2000 00:00
Date: Wed, 16 Aug 2000 00:00
43 lines
2114 bytes
2114 bytes
"Sebastien Thibault" <thibauls@videotron.ca> schreef in bericht
news:2kom5.3027$7_5.136777@weber.videotron.net...
| How do I do to compare 2 date togeter like
|
| If Date1 < Date2 Then
| Print "Date1 is smale"
| Else
| Print "Date2 is smale"
| End If
|
| What is the function to compare date in Visual Basic?
|
Dim Date1 As Date
Dim Date2 As Date
Date1 = "08/16/2000 11:00:01"
Date2 = "08/16/2000 11:00"
If Int(Date1) < Int(Date2) Then
MsgBox "Date1 is earlier then Date2"
ElseIf Int(Date1) = Int(Date2) Then
MsgBox "Date1 is eaqual to Date2"
Else
MsgBox "Date1 is later then Date2"
End If
pops up the box with "Date1 is eaqual to Date2"
BUT
If Date1 < Date2 Then
MsgBox "Date1 is earlier then Date2"
ElseIf Date1 = Date2 Then
MsgBox "Date1 is eaqual to Date2"
Else
MsgBox "Date1 is later then Date2"
End If
pops up the box with "Date1 is later then Date2"
So it depents what you want to compare, only the date reguardless the time,
or the exact date and time.
Johan.
Technical Details
Message-ID:
<BPum5.9994$63.198717@zonnet-reader-1>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<2kom5.3027$7_5.136777@weber.videotron.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1023e1,b6db5136ee9b1c1d X-Google-Attributes: gid1023e1,public X-Google-Thread: 110e3b,b6db5136ee9b1c1d X-Google-Attributes: gid110e3b,public X-Google-Thread: 108062,b6db5136ee9b1c1d X-Google-Attributes: gid108062,public X-Google-Thread: 1143a7,b6db5136ee9b1c1d X-Google-Attributes: gid1143a7,public From: "Johan Bechthum" <JohanBechthum@zonnet.nl> Subject: Re: Comparing date Date: 2000/08/16 Message-ID: <BPum5.9994$63.198717@zonnet-reader-1> X-Deja-AN: 658884460 References: <2kom5.3027$7_5.136777@weber.videotron.net> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Complaints-To: abuse@zonnet.nl X-Trace: zonnet-reader-1 966424929 212.189.164.172 (Wed, 16 Aug 2000 13:22:09 MET DST) X-MSMail-Priority: Normal NNTP-Posting-Date: Wed, 16 Aug 2000 13:22:09 MET DST Newsgroups: alt.comp.lang.visualbasic.ver3,comp.lang.basic.visual.database,comp.lang.basic.visual.misc,cz.comp.lang.basic.visual