Skip to content

Instantly share code, notes, and snippets.

@miguelangelgonzalez
Created May 19, 2015 13:34
Show Gist options
  • Save miguelangelgonzalez/6dcec2a2f6edc2d55960 to your computer and use it in GitHub Desktop.
Save miguelangelgonzalez/6dcec2a2f6edc2d55960 to your computer and use it in GitHub Desktop.
DateExtensions
using System;
using System.Globalization;
namespace Common.Extensions
{
public static class DateExtensions
{
public static DateTime January(this int year, int day)
{
return new DateTime(year, 1, day);
}
public static DateTime February(this int year, int day)
{
return new DateTime(year, 2, day);
}
public static DateTime March(this int year, int day)
{
return new DateTime(year, 3, day);
}
public static DateTime April(this int year, int day)
{
return new DateTime(year, 4, day);
}
public static DateTime May(this int year, int day)
{
return new DateTime(year, 5, day);
}
public static DateTime June(this int year, int day)
{
return new DateTime(year, 6, day);
}
public static DateTime July(this int year, int day)
{
return new DateTime(year, 7, day);
}
public static DateTime August(this int year, int day)
{
return new DateTime(year, 8, day);
}
public static DateTime September(this int year, int day)
{
return new DateTime(year, 9, day);
}
public static DateTime October(this int year, int day)
{
return new DateTime(year, 10, day);
}
public static DateTime November(this int year, int day)
{
return new DateTime(year, 11, day);
}
public static DateTime December(this int year, int day)
{
return new DateTime(year, 12, day);
}
public static string ToMonthName(this int month)
{
return CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(month);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment