Created
September 10, 2012 22:30
-
-
Save keyvan/3694449 to your computer and use it in GitHub Desktop.
Find the week of the year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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