C#指定日期为一年中的第几周

        /// <summary>
        /// 获取指定时间在为一年中为第几周
        /// </summary>
        /// <param name="dt">指定时间</param>
        /// <reutrn>返回第几周</reutrn>
        private static int GetWeekOfYear(DateTime dt)
        {
            GregorianCalendar gc = new GregorianCalendar();
            int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
            return weekOfYear;
        }

 

posted @ 2015-11-25 15:23  b̶i̶n̶g̶.̶  阅读(203)  评论(0编辑  收藏  举报