public void GetWMDay()
{
List<string> list = new List<string>();
string year = "";
DateTime counYear = Convert.ToDateTime(year + "-01-01"); //
DateTime nestYear = counYear.AddYears(); for (DateTime i = counYear; i < nestYear; i = i.AddDays())
{
if ((int)i.DayOfWeek == )
{ // 周日 to do } list.Add("周日" + i.ToShortDateString());
}
else if ((int)i.DayOfWeek == )
{ //周六 to do }
list.Add("周六" + i.ToShortDateString());
}
} MessageBox.Show("完成");
}
  /// <summary>
/// 获得指定年,月 的周六和周日的 年月日
/// </summary>
/// <param name="year"></param>
/// <returns></returns>
public List<DateTime> GetWMDay(int year,int month)
{
List<DateTime> list = new List<DateTime>();
DateTime counYear = Convert.ToDateTime(string.Format("{0}-{1}-01",year,month));
DateTime nestYear = counYear.AddMonths();
for (DateTime i = counYear; i < nestYear; i = i.AddDays())
{
if ((int)i.DayOfWeek == )
{ // 周日 to do } list.Add(i);
}
else if ((int)i.DayOfWeek == )
{ //周六 to do }
list.Add(i);
}
}
return list;
}

C# 获取当年的周六周日的更多相关文章

  1. C#去掉周六周日的算法

    /// <summary> /// 用来获取工作日(不含周六周日) /// </summary> /// <param name="dtSub"> ...

  2. WPF 自定义Calendar样式(日历样式,周六周日红色显示)

    一.WPF日历控件基本样式 通过Blend获取到Calendar需要设置的三个样式CalendarStyle.CalendarButtonStyle.CalendarDayButtonStyle.Ca ...

  3. 本月周六周日LIST集合

    最近项目中有用到本月所有的周六,周日,特此分享一下! 算法思路:写一个循环,条件为本月开始日期.本月截至日期,通过循环获取第一个周六,加一天就是周日,每增加六天就是下一个周六,依次类推,循环到月末 代 ...

  4. SQL取出 所有周六 周日的日期

    SQL取出 所有周六 周日的日期 create table SatSun([id] int identity(1,1),[date] datetime,[weekday] char(6)) go de ...

  5. JS获取当年当月最后一天日期

    <html xmlns="http://www.w3.org/1999/xhtml" > <meta charset="UTF-8"> ...

  6. PHP获取时间排除周六、周日的两个方法

    //方法一: <?php $now = time(); //指定日期用法 $now = strtotime('2014-01-08') ; $day = 3600*24; $total = 12 ...

  7. sql 获取本周周一和周日

    版本1.0(获取周日存在问题,请勿使用,仅用于引以为戒) 存在问题,获取周日的时候,当当前时间正好是周日,会获取下一周的周日,而非本周周日. ,)),) ),, ,)),) 版本2.0 看到版本1.0 ...

  8. JEECG 深度使用培训班 周六周日公开课(一期班)

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/zhangdaiscott/article/details/25411023 广大技术爱好者:     ...

  9. oracle如何获取当年第一月,如今年是2015年,则需获取 201501

    当年第一个月 SQL> select to_char(sysdate,'yyyy')||'01' from dual;TO_CHA ------ 201501当前年,月 SQL> sele ...

随机推荐

  1. 46.Android 自己定义Dialog

    46.Android 自己定义Dialog Android 自己定义Dialog 前言 提示Dialog 提示Dialog 效果图 菜单Dialog 菜单Dialog 效果图 DialogActivi ...

  2. 3.1 The Interpolating Polynomial(站点)

    Cubic Interpolation:                               https://www.youtube.com/watch? v=EtzlEA9MIwI Quad ...

  3. C++对象模型——Template中的名称决议方式 (第七章)

    Template中的名称决议方式 (Name Resolution within a Template) 必须可以区分下面两种意义,一种是C++ Standard所谓的"sope of th ...

  4. sql_server_action

    ''' SELECT * FROM Info_Roles WHERE Flag=1 LIMIT 2; select top y * from 表 where 主键 not in(select top ...

  5. Baum–Welch algorithm

    Baum–Welch algorithm 世界上只有一个巴菲特,也只有一家文艺复兴科技公司_搜狐财经_搜狐网 http://www.sohu.com/a/157018893_649112

  6. X86架构下Linux启动过程分析

    1.X86架构下的从开机到Start_kernel启动的整体过程 这个过程简要概述为: 开机-->BIOS-->GRUB/LILO-->Linux Kernel 其执行的流程图和重要 ...

  7. 布局技巧1:创建可重用的UI组件(include标签)

    Android平台提供了大量的UI构件,你可以将这些小的视觉块(构件)搭建在一起,呈现给用户复杂且有用的画面.然而,应用程序有时需要一些高级的视觉组件.为了满足这一需求,并且能高效的实现,你可以把多个 ...

  8. Consider using EXISTS instead of IN

    redgate给出的提示 https://documentation.red-gate.com/codeanalysis/performance-rules/pe019 In theory, EXIS ...

  9. 【Hnoi2013】Bzoj3143 游走

    Position: http://www.lydsy.com/JudgeOnline/problem.php?id=3143 List Bzoj3143 Hnoi2013 游走 List Descri ...

  10. openstack instance resize to

    Icehouse resize No valid host was found Hi all!! We're currently experimenting an error that's it's ...