Get mont name from int


/ Published in: C#
Save to your folder(s)

Get month name for given integer.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.