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

推荐订阅源

Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
博客园 - 【当耐特】
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
D
Docker
GbyAI
GbyAI
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
The Cloudflare Blog
雷峰网
雷峰网
A
About on SuperTechFans
小众软件
小众软件
博客园 - Franky
博客园 - 聂微东
F
Full Disclosure
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
V2EX
Engineering at Meta
Engineering at Meta
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
量子位
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
罗磊的独立博客
Martin Fowler
Martin Fowler
D
DataBreaches.Net
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Secure Thoughts
Project Zero
Project Zero
L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tailwind CSS Blog
S
Schneier on Security
Blog — PlanetScale
Blog — PlanetScale
The Hacker News
The Hacker News
Spread Privacy
Spread Privacy
Security Latest
Security Latest
NISL@THU
NISL@THU
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
CXSECURITY Database RSS Feed - CXSecurity.com
J
Java Code Geeks

博客园 - 群

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");  
  }  
  }

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