1. ## Expiry Date

Hi everyone.
Maybe someone knows or came accross of something like that. I do have expiry date that contain only month and date. As an example like that 0909 (MMYY). I need to verify that this expiry date is greater than 90 days. Like is it is right now 0609 it should be 0909 no less.

3. ## Re: Expiry Date

TReddy - thanx

4. ## Re: Expiry Date

<font class="small">Code:</font><hr /><pre>
Dim lExpiryMonth,lExpiryYear,lCurrentYear,lCurrentMont h,lExpiryDay,lExpiryDate
Dim lDayDiff,lMonthDiff,lYearDiff
lDate = InputBox("Enter the Expiry Date ( MM/YY Format)")
If IsNumeric(lDate) = "True" And Len(lDate) = 4 Then
lDate = Trim(lDate)
lExpiryMonth = Mid(lDate,1,2)
lExpiryYear = Mid(lDate,3,4)
lExpiryDay = Day(Date)
lExpiryDate = CDate(lExpiryMonth &amp; "/" &amp; lExpiryDay &amp; "/" &amp; lExpiryYear)
lDayDiff = DateDiff("d",Date,lExpiryDate)
If lDayDiff &gt; 90 Then
MsgBox " Still days to Expire !..."
Else
End If
Else
MsgBox "Invalid Entry. Try again !..."
End If
</pre><hr />

5. ## Re: Expiry Date

I put 0909 - I get Already expired, that's they way it should be. But if I put 1009 still same. maybe it a special day for me [img]/images/graemlins/frown.gif[/img]

6. ## Re: Expiry Date

[ QUOTE ]
I need to verify that this expiry date is greater than 90 days. Like is it is right now 0609 it should be 0909 no less.

[/ QUOTE ]

How can you verify whether the date is greater than 90 Days when you don't have the day in the Date field?

[ QUOTE ]
Like is it is right now 0609 it should be 0909 no less.

[/ QUOTE ]

Based on what you said in the above statement try the below code

strExpiryDate = "0909"
If Cint(Left(strExpiryDate,2)) - Cint(Day(Now)) &gt;= 3 And
Cint(Right(strExpiryDate,2)) - Cint(Year(Now)) &gt;= 0 Then
Msgbox "Passed"
Else
Msgbox "Fail"
End If

Make sure Cint(Year(Now)) retuns 2 digits number

Thanks

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.