Skip to content

Instantly share code, notes, and snippets.

@mustmodify
Created May 28, 2019 07:16
Show Gist options
  • Save mustmodify/c8664a965a6d949708af2a59e262596b to your computer and use it in GitHub Desktop.
Save mustmodify/c8664a965a6d949708af2a59e262596b to your computer and use it in GitHub Desktop.
C# files
using System;
using System.Globalization;
namespace ProBill
{
public class Week
{
public int Year;
public int WeekOfYear;
public Week()
{
}
public Week(short year, short week)
{
this.Year = year;
this.WeekOfYear = week;
}
public Week Including( DateTime Date )
{
Week output = new Week();
GregorianCalendar cal = new GregorianCalendar(GregorianCalendarTypes.Localized);
output.Year = Date.Year;
output.WeekOfYear = cal.GetWeekOfYear(Date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
return( output );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment