|
-
Feb 1st, 2022, 09:58 AM
#5
Re: Question Database of Country, Code, Dial Code, Date & Time
To get the Short Date Format, Long Date Format, Short Time Format, and Long Time Format patterns, you can use a .NET program to loop over every culture, get the DateTimeFormat of the currently iterated culture, and then the respective pattern of the currently iterated DateTimeFormat.
https://docs.microsoft.com/en-us/dot...fo.getcultures is how you would get every culture.
https://docs.microsoft.com/en-us/dot...next-statement is how you would setup the loop to loop over every culture.
https://docs.microsoft.com/en-us/dot...datetimeformat is how you would get the DateTimeFormat of the currently iterated culture.
Here's an example:
Code:
Imports System.Globalization
Module Module1
Sub Main()
For Each cultureInformation In CultureInfo.GetCultures(CultureTypes.AllCultures)
Dim format As DateTimeFormatInfo = cultureInformation.DateTimeFormat
Console.WriteLine("Culture: {0}", cultureInformation.Name)
Console.WriteLine("{0}Long Date Format: {1}", ControlChars.Tab, format.LongDatePattern)
Console.WriteLine("{0}Short Date Format: {1}", ControlChars.Tab, format.ShortDatePattern)
Console.WriteLine("{0}Long Time Format: {1}", ControlChars.Tab, format.LongTimePattern)
Console.WriteLine("{0}Short Time Format: {1}", ControlChars.Tab, format.ShortTimePattern)
Next
Console.ReadLine()
End Sub
End Module
Fiddle: https://dotnetfiddle.net/UDQ7E7
This example uses cultures, but you could pretty easily map a culture to a country.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|