Last post May 04, 2012 08:56 AM by PatricQ1
May 04, 2012 07:40 AM|bcoffey|LINK
I am trying to do something, which I seems to be pretty simple, but no matter how I try, one thing or another doesn't seem to work. All I want to do is check if the current date is 14 days prior to an expiration date display how many days until the expiration
date, but if the current date is past the expiration date, display an expiration notice.
If have tried a bunch of different ways, but none seem to work. Here is the latest variation that is not working:
Dim ExpirationDate as Date = "07/01/2012"
Dim ExpirationNoticeDate as Date = ExpirationDate.AddDays(-14)
If Date.Today > ExpirationNoticeDate AND Date.Today < ExpirationDate Then
label.text = "NOTICE: expiration date in " & (date.Today - ExppirationDate).Days & " days."
IF Date.Compare(expirationDate, Date.Today) >= 0 then
label.text = "Uh oh, you have expired!!"
May 04, 2012 08:56 AM|PatricQ1|LINK
Dim ExpirationDate As Date = New Date(2012, 7, 1)
If DateDiff(DateInterval.Day, Today, ExpirationDate) < 14 Then
label.text = "Expired..."
label.text = "NOTICE..."
you may need to switch the dayes in the DateDiff function, it's always a gamble for me.
Basically the use of DateDiff to calculate the number of days between two dates is the point i want to make.