获取当前周的周五的日期
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;
}
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;
}
相关文章推荐
- 获取当前日期所在的周五的日期
- PHP获取当前时间、时间戳的各种格式写法汇总[日期时间]
- Js获取当前日期时间及其它操作
- java获取当前日期时间的方法
- PHP获取当前日期所在星期(月份)的开始日期与结束日期
- JavaScript获取当前日期
- 获取当前日期和农历的js代码
- (随笔)js获取当前时间并格格式化当前日期 获取date天后的日期(2014年11月27日 16:31:49)
- MYSQL 获取当前日期及日期格式,和常用时间转换函数
- 如何获取当前日期的最大时间值
- Js获取当前日期时间及其它操作(jquery?)
- java 获取当前天之后或之前7天(任意)日期
- js获取当前日期的前一天、一月、一年的日期
- 根据当前时间获取本周,下周,上周日期
- javascript获取当前日期时间和其它操作
- java获取当前日期的前一天日期与字符串日期之间的转换
- iOS 获取当前日期和星期几,改变导航系统返回按钮的标题
- 获取当前日期、时间的方式
- JS获取当前日期
- 如何获取当前日期和时间