|
-
Jan 31st, 2022, 01:51 AM
#1
Thread Starter
^:^...ANGEL...^:^
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
-
Jan 31st, 2022, 09:35 AM
#2
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.
My usual boring signature: Nothing
 
-
Jan 31st, 2022, 10:01 AM
#3
Re: Question Database of Country, Code, Dial Code, Date & Time
Have you looked at THIS one ?
Poppa
Along with the sunshine there has to be a little rain sometime.
-
Feb 1st, 2022, 09:58 AM
#4
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.
-
Feb 3rd, 2022, 07:14 PM
#5
Thread Starter
^:^...ANGEL...^:^
Re: Question Database of Country, Code, Dial Code, Date & Time
 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.
-
Feb 3rd, 2022, 07:15 PM
#6
Thread Starter
^:^...ANGEL...^:^
Re: Question Database of Country, Code, Dial Code, Date & Time
 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.
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
|