fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. DateTime dt = DateTime.UtcNow;
  8. var FirstDayOfNextMonth = new DateTime(dt.Year, dt.Month, 1).AddMonths(1);
  9. var LastDayOfCurrentMonth = FirstDayOfNextMonth.AddDays(-1);
  10. Console.WriteLine(LastDayOfCurrentMonth);
  11. }
  12. }
Success #stdin #stdout 0.04s 33896KB
stdin
Standard input is empty
stdout
2/28/2014 12:00:00 AM