🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.visualbasic.ver3
Article #63

Re: Comparing date

#63
From: Larry Linson
Date: Wed, 16 Aug 2000 04:42
43 lines
2453 bytes
In article <2kom5.3027$7_5.136777@weber.videotron.net>,
  "Sebastien Thibault" <thibauls@videotron.ca> wrote:
 > 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?

The following

  Public Function WhichIsIt(pdatFirst As Date, pdatSecond As Date) As
String

    If pdatFirst < pdatSecond Then
        WhichIsIt = "First " & pdatFirst & " is smaller"
    Else
        WhichIsIt = "First " & pdatFirst & " is equal or greater"
    End If

  End Function

when run from the Immediate Window, gave

  ? WhichIsIt(#12/31/1999#,#4/15/2000#)
   First 12/31/99 is smaller
  ? WhichIsIt(#01/01/2001#,#02/02/1902#)
   First 1/1/01 is equal or greater

and that looks OK to me, given that it was a very limited test.

--
 L. M. (Larry) Linson
  http://www.ntpcug.org - North Texas PC User Group - Visit and Join
  http://www.ntmsdevsigs.homestead.com - NTPCUG Developer SIGs
  http://homestead.deja.com/user.accdevel - Access examples


Sent via Deja.com http://www.deja.com/
Before you buy.
Technical Details
Message-ID: <8nd63g$k5r$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!supernews.com!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail
References: <2kom5.3027$7_5.136777@weber.videotron.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1143a7,b6db5136ee9b1c1d
X-Google-Attributes: gid1143a7,public
X-Google-Thread: 108062,b6db5136ee9b1c1d
X-Google-Attributes: gid108062,public
X-Google-Thread: 110e3b,b6db5136ee9b1c1d
X-Google-Attributes: gid110e3b,public
X-Google-Thread: 1023e1,b6db5136ee9b1c1d
X-Google-Attributes: gid1023e1,public
X-Google-ArrivalTime: 2000-08-15 22:04:33 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-east!supernews.com!feed2.onemain.com!feed1.onemain.com!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail
From: Larry Linson <larry.linson@ntpcug.org>
Newsgroups: alt.comp.lang.visualbasic.ver3,comp.lang.basic.visual.database,comp.lang.basic.visual.misc,cz.comp.lang.basic.visual
Subject: Re: Comparing date
Date: Wed, 16 Aug 2000 04:42:27 GMT
Organization: Deja.com - Before you buy.
Lines: 43
Message-ID: <8nd63g$k5r$1@nnrp1.deja.com>
References: <2kom5.3027$7_5.136777@weber.videotron.net>
NNTP-Posting-Host: 209.245.230.103
X-Article-Creation-Date: Wed Aug 16 04:42:27 2000 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
X-Http-Proxy: 1.1 x57.deja.com:80 (Squid/1.1.22) for client 209.245.230.103
X-MyDeja-Info: XMYDJUIDaccdevel