惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
NISL@THU
NISL@THU
T
Threatpost
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
S
Securelist
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
S
Secure Thoughts
MyScale Blog
MyScale Blog
O
OpenAI News
P
Palo Alto Networks Blog
美团技术团队
C
Cyber Attacks, Cyber Crime and Cyber Security
TaoSecurity Blog
TaoSecurity Blog
量子位
L
Lohrmann on Cybersecurity
G
GRAHAM CLULEY
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
Know Your Adversary
Know Your Adversary
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
宝玉的分享
宝玉的分享
PCI Perspectives
PCI Perspectives
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
I
InfoQ
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
S
Security @ Cisco Blogs
S
Schneier on Security
B
Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Cloudflare Blog
AWS News Blog
AWS News Blog
IT之家
IT之家
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
H
Heimdal Security Blog
I
Intezer
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Help Net Security
W
WeLiveSecurity

博客园 - 群

DataGridView调整列宽及using()的用法 COM 对象与其基础 RCW 分开后就不能再使用 终于解决了一个问题--如何在数据绑定时不让combox控件触发SelectedIndexChanged事件 如何在winform中子窗体提交数据后刷新父窗体中的DataGRIDVIEW数据? 关于在.net中 预览上传控件中路径的图片 的方法 在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)[转] 获取新插入的数据的自增ID 漂浮窗体的实现 触发器不能读『转』 Server.MapPath介绍 Server.MapPath介绍 .NET里面取2个时间相差的天数 在static方法中调用非静态方法? label分页 使用回车代替Tab键的功能代码 绘图(包括绘坐标,图片) 很不错的传值 设置ComboBox默认 动态生成图片热点
取得当前日期所在的星期里从星期一到星期日所有的日期列表
· 2007-12-03 · via 博客园 - 群

Snowdust(雪尘)回复于 2006-01-13 09:35:34 得分 30

如果星期天是一周的第一天:  
  private   void   button1_Click(object   sender,   System.EventArgs   e)  
  {  
  DateTime   dt   =   DateTime.Now.AddDays(-   (int)DateTime.Now.DayOfWeek);  
  for(int   i   =   0;   i   <   7;   i++)  
  {  
  this.textBox1.Text   +=   "\r\n"   +   dt.AddDays(i).ToString("yyyy-MM-dd");  
  }  
  }  
  如果星期天是一周的最后一天:  
  private   void   button2_Click(object   sender,   System.EventArgs   e)  
  {  
  DateTime   dt;  
  if(DateTime.Now.DayOfWeek   ==   0)  
  {  
  dt   =   DateTime.Now.AddDays(   -   6);  
  }  
  else  
  {  
  dt   =   DateTime.Now.AddDays(1   -   (int)DateTime.Now.DayOfWeek);  
  }  
  for(int   i   =   0;   i   <   7;   i++)  
  {  
  this.textBox1.Text   +=   "\r\n"   +   dt.AddDays(i).ToString("yyyy-MM-dd");  
  }  
  }

我在做人才网的时候,要求列出本周星期一到星期七的日期,用到此方法.