要实现以下功能
源代码:
DateTime dt=new DateTime();
int t=(dt.Day+2*dt.Month+3*(dt.Month+1)/5+dt.Year+dt.Year/4-dt.Year/100+dt.Year/400)%7+1;
int s = 0;
for (int i = 1; i <= 7; i++)
{
s = (t-i)<=1?-(t-i-1):7-(t-i-1);
for (int j = 1; j <= 8; j++)
{
ChkMain.Items.Add(new ListItem(DateTime.Now.AddDays(s).ToShortDateString(), i.ToString()));
}
}
int t=(dt.Day+2*dt.Month+3*(dt.Month+1)/5+dt.Year+dt.Year/4-dt.Year/100+dt.Year/400)%7+1;
int s = 0;
for (int i = 1; i <= 7; i++)
{
s = (t-i)<=1?-(t-i-1):7-(t-i-1);
for (int j = 1; j <= 8; j++)
{
ChkMain.Items.Add(new ListItem(DateTime.Now.AddDays(s).ToShortDateString(), i.ToString()));
}
}
唉真不容易,谁有简单的方法吗?