在没有任何事件的情况下自动减少asp.net中的日期 [英] Auto decrement Date in asp.net without any event

查看:64
本文介绍了在没有任何事件的情况下自动减少asp.net中的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有用户有效性。我正在向管理员展示它。那么管理员应该能够看到的任何用户剩余的有效天数。所以,我希望减少日期,因为有效时间会减少。

I have user validity in database. and I am showing it to admin. so how many validity days are left for any user, that admin should be able to see. so, I want to decrement date as the validity time decreases.

推荐答案

你好b $ b

有很多方法可以做到这一点。

简单的方法是将日期与今天的日期进行比较并计算剩余天数。

示例:

您的有效期为1年它从1-1-2013开始,到1-1-2014结束。

所以你只需要计算剩余天数并将其显示给管理员。

like你可以得到今天的日期,并从结束日期到天数差异,你将获得剩余的几天。

希望它会对你有所帮助。

尝试一些这个逻辑的代码,让我知道是否发生错误。
Hi
There are many ways to do this.
Simple way is to compare date with today''s date and calculate remaining days.
Example:
Your Validity is of 1 yr and it starts from 1-1-2013 and ends on 1-1-2014.
so you just have to calculate remaining days and show it to the Admin.
like you can get today''s date and get days difference from end date by this you will get remaining days.
Hope it will help you.
Try some code for this logic and let me know if error occurs.


这篇关于在没有任何事件的情况下自动减少asp.net中的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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