Return start and end of year given any year

abmv picture abmv · May 23, 2010 · Viewed 25.8k times · Source

I need two or one (out) C# method that will take any datetime and return the start date of year and end date of year for that year.

Answer

nothrow picture nothrow · May 23, 2010
void Dates(DateTime d, out DateTime b, out DateTime e)
{
    b = new DateTime(d.Year, 1, 1);
    e = new DateTime(d.Year, 12, 31);
}