Choose Category
using System; namespace forgetCode { class Program { static void Main(string[] args) { Console.WriteLine("Enter year in the format dd-mm-yyyy"); DateTime dt = Convert.ToDateTime(Console.ReadLine()); //Know the month int month = dt.Month; Console.WriteLine("The month in the date you entered: "+month); } } }