get week number
Published: 9. October 2011 | Updated: 12. October 2011License: Microsoft Public License (MS-PL)
Categories: Globalization » Calendar
Tags: C# DateTime Globalization
Import namespace
using System.Globalization;
Code
var culture = CultureInfo.GetCultureInfo("cs-CZ"); var dateTimeInfo = DateTimeFormatInfo.GetInstance(culture); var dateTime = DateTime.Today; int weekNumber = culture.Calendar.GetWeekOfYear(dateTime, dateTimeInfo.CalendarWeekRule, dateTimeInfo.FirstDayOfWeek);
| Send us feedback about this snippet » |





