Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / March 2008

Tip: Looking for answers? Try searching our database.

Determine if a Date is BETWEEN a date range.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 09 Mar 2008 17:07 GMT
Hi.  In my VB.NET application I need to identify whether or not a user-input
date falls in between certain date ranges.   For example, If I know my date
range is 4/1/2008 - 5/1/2008, and a user inputs 4/3/2008, I would need a
boolean TRUE indicating that the input date falls between date ranges.

I know I could do greater than/less than comparisons, but I want to check if
there's a simpler way to accomplish this.

Thank you.
Herfried K. Wagner [MVP] - 09 Mar 2008 17:33 GMT
"Mike" <Mike@discussions.microsoft.com> schrieb:
> Hi.  In my VB.NET application I need to identify whether or not a
> user-input
> date falls in between certain date ranges.   For example, If I know my
> date
> range is 4/1/2008 - 5/1/2008, and a user inputs 4/3/2008, I would need a
> boolean TRUE indicating that the input date falls between date ranges.

\\\
Dim d As Date = Date.ParseExact(...)
Dim IsDateInRange As Boolean = _
   (d >= #4/1/2008# AndAlso d <= #4/3/2008#)
///

>I know I could do greater than/less than comparisons,
> but I want to check if there's a simpler way to accomplish
> this.

I don't see why this way is not simple enough.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

SurturZ - 10 Mar 2008 06:43 GMT
Using greater than & less than is only one line of code, how much simpler can
it get??

Signature

David Streeter
Synchrotech Software
Sydney Australia

> "Mike" <Mike@discussions.microsoft.com> schrieb:
> > Hi.  In my VB.NET application I need to identify whether or not a
[quoted text clipped - 15 lines]
>
> I don't see why this way is not simple enough.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.