Advertisement
stefanpu

Get Current Culture DateTimeFormats

Jan 27th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3. using System.Text;
  4.  
  5. namespace _1.CurrentCultureDateTimeFormats
  6. {
  7.     class Program
  8.     {
  9.         static void Main()
  10.         {
  11.             //needed to display cyrillic characters
  12.             Console.OutputEncoding = Encoding.Unicode;
  13.            
  14.             DateTimeFormatInfo di = DateTimeFormatInfo.CurrentInfo;
  15.             string[] dateTimeFormats = di.GetAllDateTimePatterns();
  16.  
  17.             PrintDateTimeFormats(dateTimeFormats);
  18.         }
  19.        
  20.  
  21.         private static void PrintDateTimeFormats(string[] dateTimeFormats)
  22.         {
  23.             int index = 1;
  24.             foreach (var format in dateTimeFormats)
  25.             {
  26.                 Console.WriteLine(index+":   " + format);
  27.                 index++;
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement