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

EndOfTheDay

Returns datetime corresponding to day end

Source

public static DateTime EndOfTheDay(this DateTime date)
{
	return new DateTime(date.Year, date.Month, date.Day, 23, 59, 59, 999);
}

Example

var endOfTheDay = DateTime.Now.EndOfTheDay();

Author: Victor Rodrigues

Submitted on: 13 mei 2009

Language: C#

Type: System.DateTime

Views: 3530