熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

C#獲得當周起始日期

2013-11-13 10:00:16  來源: .NET編程 
  /// <summary>
        /// 獲得當周起始日期 賈世義
        /// </summary>
        /// <param name=startDate>提供日期</param>
        /// <param name=weekStart>周開始(為周日 周一 周二 周三 周四 周五 周六)</param>
        /// <returns></returns>
        public static DateTime GetWeekStart(DateTime startDate int weekStart)
        {
            int day = (int)startDateDayOfWeek;
            if (day > weekStart)
            {
                return startDateAddDays(weekStart day);
            }
            else if (day < weekStart)
            {
                return startDateAddDays(weekStart day );
            }
            else
            {
                return startDate;
            }
        }
From:http://tw.wingwit.com/Article/program/net/201311/12269.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.