Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Using "Date" intervals in VB.NET

Total Hit ( 2486)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


The versatile Date datatype in VB.NET provides a large amount of built in functionality to manipulate dates and times. The ability to add, subtract and compare date values is very useful in particular.
  For example, suppose you are managing hundreds of clients in an insurance company. Since insurance policies have to be renewed on a periodic basis, you need to send the client a letter just about one month in advance reminding him to renew it in time.

Now for the code:
  I have used the AddDays method of the Date class in the following sample code to determine whether renewal notice needs to be sent.

Click here to copy the following block
Private Function SendRenewalNotice(ByVal ExpiryDate As Date) As Boolean

Dim ThirtyDaysLater As Date

'Add 30 days to the system date
ThirtyDaysLater = Date.Today.AddDays(30)

'Check if expiry date is within 30 days from now
 
  If ExpiryDate <= ThirtyDaysLater And ExpiryDate >= Date.Today Then
   Return True
  Else
   Return False
  End If

End Function


Submitted By : Saikiran Jetti  (Member Since : 8/22/2004 1:01:36 PM)

Job Description : Computer Genius
View all (2) submissions by this author  (Birth Date : 4/7/1980 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.