Syntax-
int DateTime.Month;
Example to demonstrate example of DateTime.Month Property
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//creating an object of DateTime class
//and, initializing it with the current time
//using "Now"
DateTime dt = DateTime.Now;
//getting month component
string month = dt.Month.ToString();
//printing current date & time
Console.WriteLine("Current date & time is: " + dt.ToString());
//printing the day of the week
Console.WriteLine("Month is : " + month);
//just to print a new line
Console.WriteLine();
}
}
}
Output-
Current date & time is: 11/28/2020 7:08:01 AM
Month is : 11