ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

BeginningOfTheDay

Returns datetime corresponding to day beginning

Source

public static DateTime BeginningOfTheDay(this DateTime date)
{
	return new DateTime(date.Year, date.Month, date.Day);
}

Example

var beginningOfTheDay = DateTime.Now.BeginningOfTheDay();

Author: Victor Rodrigues

Submitted on: 13 mei 2009

Language: C#

Type: System.DateTime

Views: 5451