Q:

Write a C# Sharp program to display the string representation of a date using all possible standard date and time formats in the computer's current culture (en-US.)

0

Write a C# Sharp program to display the string representation of a date using all possible standard date and time formats in the computer's current culture (en-US.). 

Expected Output :

7/28/2009                                                                        
7/28/09                                                                          
07/28/09                                                                         
07/28/2009                                                                       
09/07/28     

All Answers

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

using System;
public class Example24
{
  public static void Main(String[] argv){  
    DateTime july28 = new DateTime(2009, 7, 28, 5, 23, 15, 16);

string[] july28Formats = july28.GetDateTimeFormats();

// Print out july28 in all DateTime formats using the default culture.
foreach (string format in july28Formats) {
	Console.WriteLine(format);
}
  }
}

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