日期:2014-05-20 浏览次数:20876 次
from a in fkd.Deliveries.Take(10)
where a.OrderStatusID == 5
select new
{
week = SqlFunctions.DateName(strWeek, a.ActualSendTime.Value)
};
from a in fkd.Deliveries.Take(10)
where a.OrderStatusID == 5
select new
{
week = weekofyear( a.ActualSendTime.Value)
};
public static string weekofyear(DateTime dtime)
{
int weeknum = 0;
DateTime tmpdate = DateTime.Parse(dtime.Year.ToString() + "-1" + "-1");
DayOfWeek firstweek = tmpdate.DayOfWeek;
//if(firstweek)
for (int i = (int)firstweek + 1; i <= dtime.DayOfYear; i = i + 7)
{ weeknum = weeknum + 1; }
return weeknum.ToString();
}