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 values in VB.NET

Total Hit ( 2255)

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/21/2004 9:16:25 AM)

Job Description : I'm computer engineer. I mostly work on Oracle databases - PL/SQL and Developer 9i. I've worked for the IS dept. of a large insurance company and am now working for a software consulting firm. I am also a freelance writer - I write technical articles about Oracle databases and database fundamentals.
View all (8) submissions by this author  (Birth Date : 4/7/1980 )


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

© 2008 BinaryWorld LLC. All rights reserved.