方法一:

 

private   int   WeekOfYear(string   date)
{
DateTime   curDay   =   Convert.ToDateTime(date);

int   firstdayofweek   =   Convert.ToInt32(Convert.ToDateTime(curDay.Year.ToString()   +   "- "   +   "1-1 ").DayOfWeek);

int   days   =   curDay.DayOfYear;
int   daysOutOneWeek   =   days   -   (7   -   firstdayofweek);

if   (daysOutOneWeek   <=   0)
{
return   1;
}
else
{
int   weeks   =   daysOutOneWeek   /   7;
if   (daysOutOneWeek   %   7   !=   0)
weeks   ++;

return   weeks   +   1;
}
}


方法二:

 

System.Globalization.GregorianCalendar   gc   =   new   System.Globalization.GregorianCalendar();
int   weekOfYear   =   gc.GetWeekOfYear(DateTime.Now,   System.Globalization.CalendarWeekRule.FirstDay,   DayOfWeek.Monday);

 


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/letian_fly/archive/2008/07/30/2739618.aspx

posted on 2010-11-16 10:10  金熊  阅读(625)  评论(1编辑  收藏  举报