//Octavalent Extension Methods
//http://sdfasdf.codeplex.com/
//Library of extension methods for .Net create by Octavalent (www.octavalent.nl)
using System;
public static class DateTimeExtensions
{
public static int GetDayOfWeek(this DateTime dt)
{
if (dt.DayOfWeek == DayOfWeek.Monday) return 1;
if (dt.DayOfWeek == DayOfWeek.Tuesday) return 2;
if (dt.DayOfWeek == DayOfWeek.Wednesday) return 3;
if (dt.DayOfWeek == DayOfWeek.Thursday) return 4;
if (dt.DayOfWeek == DayOfWeek.Friday) return 5;
if (dt.DayOfWeek == DayOfWeek.Saturday) return 6;
if (dt.DayOfWeek == DayOfWeek.Sunday) return 7;
return 0;
}
}
|