日期:2014-05-18  浏览次数:20361 次

跪求 循环得到两个日期(年-月-日)之间 的数组 ,兄弟们给支持一下就是最后的胜利了!
页面部分,   有两个范围,是用户可选择的范围
比如   2005-08-22         到       2007-09-20        

期望能列出

2005-08-22
2005-08-23
``````
2007-09-20        

跪求各位了,程序应该如何写

------解决方案--------------------
protected void Page_Load(object sender, EventArgs e)
{
DateTime start = Convert.ToDateTime( "2005-08-22 ");
DateTime end = Convert.ToDateTime( "2005-09-20 ");

string str = string.Empty;
DateTime temp = start;
while (!temp.Equals(end))
{
str += temp.ToShortDateString() + " <br> ";
temp = temp.AddDays(1);
}
Response.Write(str);
}
------解决方案--------------------
到数据库中写
select YourTime from table
where Convert(nvarchar(10),YourTime,120)> '2005-08-22 '
and Convert(nvarchar(10),YourTime,120)> < '2005-09-20 '
------解决方案--------------------
来晚了,顶楼上。