Skip to content

Instantly share code, notes, and snippets.

@keyvan
Created September 10, 2012 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keyvan/3694449 to your computer and use it in GitHub Desktop.
Save keyvan/3694449 to your computer and use it in GitHub Desktop.
Find the week of the year
using System;
using System.Globalization;
namespace WeekNumberCalculator
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Find the Week of the Year";
int weekNumber = CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(DateTime.Parse("2012-09-10 16:09:00"), CalendarWeekRule.FirstFullWeek,
DayOfWeek.Monday);
Console.WriteLine(string.Format("The week number is {0}, but you don't believe it ;-)", weekNumber));
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment