Question Database of Country, Code, Dial Code, Date & Time
Hi,
Working on an app where I need to have a list of Country (Australia), Country Code (AU), Dial Code (61), Short Date Format, Long Date Format, Short Time Format, Long Time Format.
Searched high and low and nothing I could find contains a succinct information.
Is there a global list/database available with above information that I can use? Happy with CSV, JSON, XML or other format that I can convert as needed.
Cheers :)
Re: Question Database of Country, Code, Dial Code, Date & Time
The question might get better answers here, and doesn't apply to .NET, so this is a better place for it.
Re: Question Database of Country, Code, Dial Code, Date & Time
Have you looked at THIS one ?
Poppa
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.
Re: Question Database of Country, Code, Dial Code, Date & Time
Quote:
Originally Posted by
Poppa Mintin
Have you looked at
THIS one ?
Poppa
Thanks. I did but I also wanted a standard date time formats that go along for each country. Turns out that it is not tied to the country but rather the region and the language so more work is needed from my part.
Re: Question Database of Country, Code, Dial Code, Date & Time
Quote:
Originally Posted by
dday9
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.
Thanks. I was originally using that but hoping that there will be a standard date time formats that go along for each country. Turns out that it is not tied to the country but rather the region and the language so more work is needed from my part.