C# Getting Today's Date
In C# there are different methods to fetch today's date. Let's examine the examples below..
namespace ConsoleApplicationTest
{
class Program {
static void Main(string[] args) {
DateTime t1 = System.DateTime.Today;
string t2 = DateTime.Today.ToString("d/MM/yyyy");
string t3 = DateTime.Now.ToString("d/MM/yyyy");
string t4 = DateTime.Now.Date.ToShortDateString();
Console.WriteLine(t1);
Console.WriteLine(t2);
Console.WriteLine(t3);
Console.WriteLine(t4);
Console.ReadLine();
}
}
}