ALL the patterns : DateTimeFormatInfo « Date Time « C# / C Sharp






ALL the patterns

  

 using System;
 using System.Globalization;
 public class SamplesDateTimeFormatInfo  {
    public static void Main()  {
       DateTimeFormatInfo myDtfi = new DateTimeFormatInfo();
       String[] myPatternsArray = myDtfi.GetAllDateTimePatterns();
       PrintIndexAndValues( myPatternsArray );

       myPatternsArray = myDtfi.GetAllDateTimePatterns('d');
       Console.WriteLine( "The patterns for 'd':" );
       PrintIndexAndValues( myPatternsArray );

       myPatternsArray = myDtfi.GetAllDateTimePatterns('D');
       Console.WriteLine( "The patterns for 'D':" );
       PrintIndexAndValues( myPatternsArray );

       myPatternsArray = myDtfi.GetAllDateTimePatterns('f');
       Console.WriteLine( "The patterns for 'f':" );
       PrintIndexAndValues( myPatternsArray );

       myPatternsArray = myDtfi.GetAllDateTimePatterns('F');
       Console.WriteLine( "The patterns for 'F':" );
       PrintIndexAndValues( myPatternsArray );

       myPatternsArray = myDtfi.GetAllDateTimePatterns('r');
       Console.WriteLine( "The patterns for 'r':" );
       PrintIndexAndValues( myPatternsArray );

       myPatternsArray = myDtfi.GetAllDateTimePatterns('R');
       Console.WriteLine( "The patterns for 'R':" );
       PrintIndexAndValues( myPatternsArray );
    }

    public static void PrintIndexAndValues( String[] myArray )  {
       int i = 0;
       foreach ( String s in myArray )
          Console.WriteLine( "\t[{0}]:\t{1}", i++, s );
    }
 }
/*
  [0]:  MM/dd/yyyy
  [1]:  yyyy-MM-dd
  [2]:  dddd, dd MMMM yyyy
  [3]:  dddd, dd MMMM yyyy HH:mm
  [4]:  dddd, dd MMMM yyyy hh:mm tt
  [5]:  dddd, dd MMMM yyyy H:mm
  [6]:  dddd, dd MMMM yyyy h:mm tt
  [7]:  dddd, dd MMMM yyyy HH:mm:ss
  [8]:  MM/dd/yyyy HH:mm
  [9]:  MM/dd/yyyy hh:mm tt
  [10]:  MM/dd/yyyy H:mm
  [11]:  MM/dd/yyyy h:mm tt
  [12]:  yyyy-MM-dd HH:mm
  [13]:  yyyy-MM-dd hh:mm tt
  [14]:  yyyy-MM-dd H:mm
  [15]:  yyyy-MM-dd h:mm tt
  [16]:  MM/dd/yyyy HH:mm:ss
  [17]:  yyyy-MM-dd HH:mm:ss
  [18]:  MMMM dd
  [19]:  MMMM dd
  [20]:  yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK
  [21]:  yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK
  [22]:  ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
  [23]:  ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
  [24]:  yyyy'-'MM'-'dd'T'HH':'mm':'ss
  [25]:  HH:mm
  [26]:  hh:mm tt
  [27]:  H:mm
  [28]:  h:mm tt
  [29]:  HH:mm:ss
  [30]:  yyyy'-'MM'-'dd HH':'mm':'ss'Z'
  [31]:  dddd, dd MMMM yyyy HH:mm:ss
  [32]:  yyyy MMMM
  [33]:  yyyy MMMM
The patterns for 'd':
  [0]:  MM/dd/yyyy
  [1]:  yyyy-MM-dd
The patterns for 'D':
  [0]:  dddd, dd MMMM yyyy
The patterns for 'f':
  [0]:  dddd, dd MMMM yyyy HH:mm
  [1]:  dddd, dd MMMM yyyy hh:mm tt
  [2]:  dddd, dd MMMM yyyy H:mm
  [3]:  dddd, dd MMMM yyyy h:mm tt
The patterns for 'F':
  [0]:  dddd, dd MMMM yyyy HH:mm:ss
The patterns for 'r':
  [0]:  ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
The patterns for 'R':
  [0]:  ddd, dd MMM yyyy HH':'mm':'ss 'GMT'


*/

   
    
  








Related examples in the same category

1.CultureInfo Provides information about a specific culture
2.Determines the specific cultures that use the Chinese language, and displays the parent culture
3.Gets or sets a DateTimeFormatInfo that defines the culturally appropriate format of displaying dates and times.
4.Gets the list of calendars that can be used by the culture.
5.Custom Date and Time Format Strings
6.DateTimeFormatInfo Class
7.DateTimeFormatInfo.AbbreviatedMonthGenitiveNames
8.DateTimeFormatInfo.FullDateTimePattern
9.DateTimeFormatInfo.LongDatePattern
10.DateTimeFormatInfo.LongTimePattern
11.DateTimeFormatInfo.MonthDayPattern
12.DateTimeFormatInfo.RFC1123Pattern
13.DateTimeFormatInfo.ShortDatePattern
14.DateTimeFormatInfo.ShortTimePattern
15.DateTimeFormatInfo.SortableDateTimePattern
16.DateTimeFormatInfo.UniversalSortableDateTimePattern
17.DateTimeFormatInfo.YearMonthPattern
18.To Short Date Time
19.To Date Time from dmtf date