How to extract and display the month from DateTime in C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            DateTime now = DateTime.Now;

            string month = now.ToString("M ");

            Console.WriteLine($"{month}");
        }
    }
}


/*
run:
 
8

*/

 



answered Aug 14, 2018 by avibootz

Related questions

1 answer 137 views
2 answers 194 views
2 answers 202 views
3 answers 229 views
1 answer 157 views
1 answer 132 views
1 answer 181 views
...