您好先生,我想要一些参考来编写C#编码 [英] Hello sir, I want Some Reference to Write C# coding

查看:65
本文介绍了您好先生,我想要一些参考来编写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.


这篇关于您好先生,我想要一些参考来编写C#编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆