|
|
|
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
ThirtyDaysLater = Date.Today.AddDays(30)
If ExpiryDate <= ThirtyDaysLater And ExpiryDate >= Date.Today Then Return True Else Return False End If
End Function |
|
|
|
|
|