Iterate each standard format specifier and combine them with different cultures : Date Time Format « Date Time « VB.Net






Iterate each standard format specifier and combine them with different cultures

 

Imports System.Globalization

Module Example
   Public Sub Main()
      Dim formats() As String = {"d", "D", "f", "F", "g", "G", "m", "o", "r", _
                                 "s", "t", "T", "u", "U", "Y"}

      Dim cultures() As CultureInfo = {CultureInfo.CreateSpecificCulture("de-DE"), _
                                       CultureInfo.CreateSpecificCulture("en-US"), _
                                       CultureInfo.CreateSpecificCulture("es-ES"), _
                                       CultureInfo.CreateSpecificCulture("fr-FR")}

      Dim dateToDisplay As Date = #10/1/2010 17:04:32#


      For Each formatSpecifier As String In formats
         For Each culture As CultureInfo In cultures
            Console.WriteLine("{0} Format Specifier {1, 10} Culture {2, 40}", _
                              formatSpecifier, culture.Name, _
                              dateToDisplay.ToString(formatSpecifier, culture))
         Next
      Next                                       
   End Sub
End Module

   
  








Related examples in the same category

1.IFormatProvider Interface Provides a mechanism for retrieving an object to control formatting.
2.Format TimeSpan to string
3.Format TimeSpan to get hours
4.Using different culture to format Date
5.Output date and time using each standard format string
6.Create custom format strings for Date
7.Attempt to convert a string in improper ISO 8601 format
8.Assume a date and time string formatted for the fr-FR culture is the local time and convert it to UTC
9.Convert Date to String with format: F
10.Convert Date to String with format: F and fr-FR culture
11.Get the long date formats using the current culture
12.Get the short date formats using the "fr-FR" culture.
13.Get the short date formats using the "fr-FR" culture
14.Attempt to convert a string in improper ISO 8601 format
15.Assume a date and time string formatted for the fr-FR culture is the local time and convert it to UTC
16.Custom Date and Time Format Strings
17.Display the long time pattern and string
18.Display the short date pattern and string.
19.Display the short time pattern and string
20.Short Date Pattern
21.Long Date Pattern
22.Full Date Time Pattern
23.Month Day Pattern
24.RFC1123 Pattern
25.RFC1123 Pattern
26.Sortable Date Time Pattern
27.Short Time Pattern
28.Long Time Pattern
29.Universal Sortable Date Time Pattern
30.Year Month Pattern
31.Output Date in different culture format