Get Week of the Year

Author posted by Jitendra on Posted on under category Categories c# and tagged as Tags with Leave a comment on Get Week of the Year

get the Week Number of the year in C#

        /// <summary>
        /// Gets the week number of Year.
        /// </summary>
        /// <param name="dtPassed">The dt passed.</param>
        /// <returns></returns>
        private int GetWeekNumber(DateTime dtPassed)
            CultureInfo ciCurr = CultureInfo.CurrentCulture;
            int weekNum = ciCurr.Calendar.GetWeekOfYear(dtPassed, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
            return weekNum;

Related posts

Leave a Reply