Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return start and end of year given any year [duplicate]

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.

like image 486
abmv Avatar asked May 23 '10 10:05

abmv


2 Answers

void Dates(DateTime d, out DateTime b, out DateTime e)
{
    b = new DateTime(d.Year, 1, 1);
    e = new DateTime(d.Year, 12, 31);
}
like image 124
nothrow Avatar answered Oct 14 '22 02:10

nothrow


DateTime startDate = new DateTime(year, 1, 1);
DateTime endDate = new DateTime(year, 12, 31);
like image 20
Darin Dimitrov Avatar answered Oct 14 '22 01:10

Darin Dimitrov