I would first get the first day of the year and subtract one, like so:
DateTime lastDayOfPreviousYear = (new DateTime(year, 1, 1)).AddDays(-1);
Then, you can add the number of days to the lastDayOfPreviousYear and it
will give you the appropriate DateTime:
DateTime dateTime = lastDayOfPreviousYear.AddDays(days);
Of course, you can just get the first date of the year, and subtract one
from the number of days, like so:
DateTime firstDayOfYear = new DateTime(year, 1, 1);
DateTime dateTime = firstDayOfYear.AddDays(days - 1);
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"O.B." <fu******@bellsouth.netwrote in message
news:11********************@e9g2000prf.googlegroup s.com...
Does C# provide an operation for converting year and day-of-the-year
(1-365) to a DateTime object?