c# - 如何在 for 循环中使用日期时间?

标签 c# .net

如何在 for 循环中使用 datetime

有两个变量duedatereturndate,返回日期为当前日期,duedate加1天等于returndate。

如何在 for 循环中使用它?

最佳答案

你可以使用:

DateTime start = ...;
DateTime finish = ...;

for (DateTime x = start; x <= finish; x = x.AddDays(1))
{
   ... // use x
}

关于c# - 如何在 for 循环中使用日期时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5179244/

相关文章:

c# - BrokeredMessage 反序列化带有不需要的字符串

javascript - __doPostBack 只有在页面上有 LinkBut​​ton、Calendar 或 WizardStep 控件时才有效

c# - 使用 C# 检查进程是否正在远程系统上运行

c# - 错误 :The given path's format is not supported

c# - 是否有一种(优雅的)解决方案可以在方法中进一步约束泛型类型参数?

c# - 如何对一系列依赖于用户输入并相互依赖的进程使用控制反转?

.net - 为什么 Entity Framework 试图插入 NULL?

.net - 如何调试随机挂起

.net - .NET SelectNodes()是否允许您选择属性?

c# - 如何将泛型类型传递给泛型方法?