Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

converting Month to proper name

Back to Forum: Tech Off
  • User profile image
    venkatzeus

    HI..
      i want to convert the Month value to its string value. For example,

    DateTime TheStartDate = DateTime.Parse(txtStartDate.Text);

    string TheStartMonth = TheStartDate.Month.ToString();

    Here i am getting the Month value as integer, but i want in its proper name. Now i am getting month value as 4, but i need it as April..
     
    How to do that?

  • User profile image
    TommyCarlier

    string TheStartMonth = System.Globalization.DateTimeFormatInfo.CurrentInfo.GetMonthName(TheStartDate.Month);

  • User profile image
    Ion Todirel

    string monthString = TheStartDate.ToString("MMMM");

    For more information chekout this MSDN article: Standard DateTime Format Strings

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.