Adding days to a DateTime in C#
Is it possible to a开发者_如何转开发dd dates in C#?
(DateTime.Today.ToLongDateString() + 10)
I tried this but it doesn't work.
Do you want to add days?
DateTime newDate = DateTime.Today.AddDays(10);
Note that you get a new DateTime back!
MSDN
Use DateTime.Today.AddDays(10)
or any of the other AddXXX functions on DateTime.
What is the unit of 10. If it is days; then
var todayPlus10Days = DateTime.Today.AddDays(10);
Use AddDays() method:
DateTime dt = DateTime.Today;
dt = dt.AddDays(10);
精彩评论