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. wsgi初探

    大半夜的不睡觉,起来看技术文档,我这是什么精神啊~ ok 本文的大部分内容都是阅读 http://wsgi.readthedocs.org/en/latest/ 得来的.下面开始研究 wsgi wsg ...

  2. maven更改镜像路径为阿里镜像,以便下载速度快

    1.maven更改镜像路径为阿里镜像,以便下载速度快 2.maven每更新一次镜像地址,都会重新下载一次包 3. 怎么配maven链接阿里云的镜像详细步骤 修改maven根目录下的conf文件夹中的s ...

  3. git bash here真牛!

    git bash here真牛! 在Windows上面安装了git,在文件夹里面空白处右键点击,选择git bash here: 随手敲了几个命令:ls,ls -a,which ls,who, fin ...

  4. 2015 Multi-University Training Contest 2 1004 Delicious Apples(DP)

    pid=5303">题目链接 题意:长度为l 的环,有n棵果树,背包容量为k,告诉你k棵苹果树的id.以及每棵树上结的果子数.背包一旦装满要返回起点(id==0) 清空,问你至少走多少 ...

  5. 22、Cocos2dx 3.0游戏开发找小三之音乐与音效:假如世界上没有了音乐,你的耳朵会孤单吗?

    重开发人员的劳动成果,转载的时候请务必注明出处:http://blog.csdn.net/haomengzhu/article/details/30485103 假如世界上没有了音乐,在森林里.我们听 ...

  6. zoj 1610 Count the Colors 【区间覆盖 求染色段】

    Count the Colors Time Limit: 2 Seconds      Memory Limit: 65536 KB Painting some colored segments on ...

  7. Mongo性能测试-python脚本

    单线程 500+w条数据,插入时间:1小时,13分钟. 脚本: [root@10 hurl]# cat insert-mongo2.py #!/usr/bin/env python #coding=u ...

  8. java.io.IOException: The same input jar is specified twice

    简介: eclipse android proguard 打包时出现 java.io.IOException: The same input jar is specified twice 错误, 这里 ...

  9. string转date

    /*util-->sql*/ java.util.Date utdt; java.sql.Date sqldt =null; SimpleDateFormat simFormat = new S ...

  10. [SCOI 2010] 连续攻击游戏

    [题目链接] https://www.luogu.org/problemnew/show/P1640 [算法] 二分图匹配 实现时需要常数优化和特判 [代码] //code by byf and lm ...