您的位置:首页 > 其它

获取当前周的周五的日期

2008-08-15 10:38 218 查看
Code

private static DateTime GetFridayDate(DateTime standardDate)

{

int weekNum = (int)standardDate.DayOfWeek;

DateTime fridayDate = standardDate;

if (weekNum > 0 && weekNum <= 5)

{

fridayDate = standardDate.AddDays(5 - weekNum);

}

else

{

if (weekNum == 6)

{

fridayDate = standardDate.AddDays(-1);

}

else if (weekNum == 0)

{

fridayDate = standardDate.AddDays(-2);

}

}

return fridayDate;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: