Wednesday, March 9, 2011

Fun with Enums: Calculate next Monday

I needed to calculate a couple of interesting dates for the Notary system.

 

Next Monday:
  DateTime.Now.AddDays(8 - (int)DateTime.Now.DayOfWeek)

The last day of the birth month, 4 years from now:
  new DateTime(DateTime.Now.Year + 4, dobDt.Month, 1).AddMonths(1).AddDays(-1);

No comments: