win7 64加载驱动:c#如何对时间进行运算

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/04 12:29:58
数据库中有一个时间值,假设允许期限为15天,要计算还剩下多少时间,精确到小时,用C#如何做。

不是很明白你的意思我的理解是:
用一个变量存储你的本地时间string strDate=DateTime.Now.Year.ToString()+DateTime.Now.Month.ToString()+DateTime.Now.Day.ToString()+DateTime.Now.Hour+ToString();

然后把你在数据库里的时间取出来
最后还剩下多少时间=数据库的时间-Convert.Int32(strDate);