Q:

Write a C# Sharp program to retrieve the current date

0

Write a C# Sharp program to retrieve the current date. 

Expected Output :

General format 8/20/2016 12:00:00 AM                                    
Display the date in a variety of formats:                               
8/20/2016                                                               
Saturday, August 20, 2016                                               
8/20/2016 12:00 AM 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 using System;

public class Example8
{
   public static void Main()
   {
      // Get the current date.
      DateTime thisDay = DateTime.Today;
      Console.WriteLine("General format " +thisDay.ToString());
      Console.WriteLine("Display the date in a variety of formats: ");
      Console.WriteLine(thisDay.ToString("d"));
      Console.WriteLine(thisDay.ToString("D"));
      Console.WriteLine(thisDay.ToString("g"));
   }
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now