Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to Write message code for expired period of 60 days from the time of user login date & time?
Posted

Here's some sample code:
// Start by making this a DateTime, not a string
DateTime start = DateTime.Parse("03/03/2011");
// Expire 60 days from start
DateTime expire = start.AddDays(60);
if (DateTime.Now > expire)
{
   // You're past the expiration date
}


Hope this might help you.
 
Share this answer
 
v2
Comments
thatraja 3-Mar-11 2:25am    
code block fixed
[no name] 3-Mar-11 3:43am    
Thanks Raja.
Steps:
1. On login for first time, store the first login date in your database
2. Now, on every login, when authenticating check the current DateTime with the 1st login Datetime.
3. If the difference is less than 60 days, allow or else show an appropriate message stating your 60 days are up.

Try!
 
Share this answer
 
Comments
Monjurul Habib 3-Mar-11 2:34am    
nice advice 5+
Manfred Rudolf Bihy 3-Mar-11 2:48am    
Straight forward advice! 5+

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