Posted By

leonbda on 02/17/09


Tagged

month DateTime


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Get mont name from int


 / Published in: C#
 

Get month name for given integer.

  1. GetMonthName(i, false)
  2.  
  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.