如何设置帐户的到期日期 [英] How to set an expiry date for an account

查看:112
本文介绍了如何设置帐户的到期日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我有一个数据库,我在c#中创建一个插入方法,将记录插入成员表中



我已插入名字,姓氏,电子邮件地址等,但我想插入一个到期日



现在我想要它从注册之日起3年。



有没有办法做到这一点?



尽可能简单,我是一个非常大的新手。

Basically, i have a database and im creating an insert method in c# that inserts a record into a member table

I have inserted the firstname, surname, email address etc but i want to insert an expiry date

Now i want it so its 3 years from the day they registered.

Is there a way to do this?

as simple as you possibly can, im a very very big newbie.

推荐答案

有一些 http://www.dotnetperls.com/datetime 上的日期/时间示例[ ^ ]



对于您的情况,您可以:< br $>


There are some good Date/Time examples at http://www.dotnetperls.com/datetime[^]

For your case, you can do:

DateTime expiryDate = DateTime.Today.AddYears(3);





然后将expiryDate添加到你的sql中,并将其保存到表中。



And then add expiryDate to your sql that saves it into the table.


这篇关于如何设置帐户的到期日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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