Posted By

leonbda on 02/17/09


month DateTime

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Get mont name from int

 / Published in: C#

Get month name for given integer.

  1. GetMonthName(i, false)
  3. private static string GetMonthName(int month, bool abbrev)
  4. {
  5. DateTime date = new DateTime(1900, month, 1);
  6. if (abbrev) return date.ToString("MMM");
  7. return date.ToString("MMMM");
  8. }

Report this snippet  

You need to login to post a comment.