Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi frnds,

I want to display the expiry message 1 month before the expiry date.
It should not display if the expiry date more than one month compare to todays date.

In sql database, am using field as expiry date.

on my webpage i have a label to display the expiry date.

Thanks.
Posted
Comments
syed shanu 5-Nov-14 4:30am    
So what is the problem ,where you want to check in you sql db or by your c# code from label input.

 
Share this answer
 
Comments
Rajesh waran 5-Nov-14 5:05am    
Good one.My +5
solution 1 from the link that you have provided is simple and good.
Praveen_P 5-Nov-14 6:21am    
+ 5
I can tell you 2 simple solution one is you can check in you Db and return the Expiredate and status as true or fales for example if expiry date is > then 30 days + todays date then it should return the false .If todays date add 30 days is < expirey date then return true and display your warning message.

here is sample SQL query for you.

SQL
declare @Expireye datetime,
        @eDate datetime;
 
select  @Expireye = '12/25/2014 08:00:00' 
  

select  @Expireye as expireDate,getdate() as todaysdate,DATEADD(day,30,getdate())as TodatedatePlus30days,
case when DATEADD(day,30,getdate()) < @Expireye Then 'False' Else 'true' END as ExpiryStatus
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900