Date with C#

Dates and times are very important in software development.  C# has built-in methods for manipulating dates and time and we will discuss those with the help of this example. using System; namespace DatesAndTimes { class Program { static void Main(string[] args) { DateTime myValue = DateTime.Now; Console.WriteLine(myValue.ToString()); Console.WriteLine(myValue.ToShortDateString()); Console.WriteLine(myValue.ToShortTimeString()); Console.WriteLine(myValue.ToLongDateString()); Console.WriteLine(myValue.ToLongTimeString()); Console.WriteLine(myValue.AddDays(3).ToLongDateString()); Console.WriteLine(myValue.AddHours(3).ToLongTimeString()); Console.WriteLine(myValue.AddDays(-3).ToLongDateString()); Console.WriteLine(myValue.Month); DateTime […]

Read More