您好先生,我想要一些参考来编写C#编码

问题描述:

如何编写自用户登录日期和时间起60天到期的消息代码?

How to Write message code for expired period of 60 days from the time of user login date & time?

步骤:
1.首次登录时,将首次登录日期存储在数据库中
2.现在,在每次登录时,在进行身份验证时,请使用第一个登录日期Datetime来检查当前的DateTime.
3.如果相差少于60天,则允许或显示一条适当的消息,说明您的60天已到.

试试吧!
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!


这里有一些示例代码:
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.