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

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

PHP中文网
Release: 2016-05-23 17:10:11
Original
1131 people have browsed it

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

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

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

Related labels:
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template