Home  >  Article  >  php教程  >  ASP.NET如何获取两个日期之间的天数_实用技巧

ASP.NET如何获取两个日期之间的天数_实用技巧

PHP中文网
PHP中文网Original
2016-05-23 17:10:111046browse

这篇文章主要介绍了ASP.NET获取两个日期之间的天数方法,需要的朋友可以参考下

DateTime startdate=DateTime.Parse("2013-11-01"); 
DateTime enddate = DateTime.Parse("2013-11-11"); 
int d = enddate.Subtract(startdate).Days;

定义开始时间startdate
结束时间enddate
使用方法Subtract得到两个时间差

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php单例模式Next article:php二维数组根据键值排序