International Date Formats






1.18/5 (5 votes)
This article explains different date formats based on locale
Introduction
This is a sequel to an article I wrote 8 years ago about number formats in .Net. This one is about Date formats in .Net. Here is the code lists all of the number formats out there in VB.NET:
Dim oHashtable As New Hashtable
For Each oCultureInfo As System.Globalization.CultureInfo _
In System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures)
Dim sKey As String = oCultureInfo.Name
Dim sName As String = oCultureInfo.EnglishName
Try
Dim d As Date = DateTime.Parse("1/2/3", oCultureInfo)
Dim sFormat As String = d.ToString()
If oHashtable.ContainsKey(sFormat) = False Then
oHashtable.Add(sFormat, sKey & " - " & sName)
Else
oHashtable(sFormat) += "<br>" & sKey & " - " & sName
End If
Catch ex As Exception
End Try
Next
Dim sb As New System.Text.StringBuilder()
Response.Write("<table border=1>" & vbCrLf)
Response.Write("<tr><th>Format</th><th>Country</th></tr>" & vbCrLf)
For Each oEntry As DictionaryEntry In oHashtable
Response.Write("<tr><td valign=top>" & oEntry.Key & "</td><td>" & _
oEntry.Value & "</td></tr>" & vbCrLf)
Next
Response.Write("</table>")
This code converts "1/2/3" to date using different cultures.
2/1/2003 is the most common
2/3/2001 is second
1/2/2003 is the least common format and is used by US.
One interesting finding is that some cultures (Arabic, Pashto, Dari and Divehi ) cannot convert “1/2/3” at all (you get 11/16/1982 and 11/17/1982). I am not sure if this has to do with the right-to-left writing. Thai converts “3” to 1960.
Here is the table this VB.NET code returns:
Format | Country |
---|---|
1/2/2003 12:00:00 AM | en - English fa - Persian sw - Kiswahili ne - Nepali fil - Filipino moh - Mohawk - Invariant Language (Invariant Country) sah - Yakut rw - Kinyarwanda en-US - English (United States) fa-IR - Persian sw-KE - Kiswahili (Kenya) ne-NP - Nepali (Nepal) fil-PH - Filipino (Philippines) moh-CA - Mohawk (Mohawk) sah-RU - Yakut (Russia) rw-RW - Kinyarwanda (Rwanda) es-PA - Spanish (Panama) en-029 - English (Caribbean) en-ZW - English (Zimbabwe) en-PH - English (Republic of the Philippines) es-US - Spanish (United States) |
2/1/2003 12:00:00 AM | bg - Bulgarian ca - Catalan cs - Czech da - Danish de - German el - Greek es - Spanish fi - Finnish fr - French he - Hebrew is - Icelandic it - Italian nl - Dutch no - Norwegian pt - Portuguese rm - Romansh ro - Romanian ru - Russian hr - Croatian sk - Slovak tr - Turkish ur - Urdu id - Indonesian uk - Ukrainian be - Belarusian sl - Slovenian et - Estonian tg - Tajik vi - Vietnamese hy - Armenian az - Azeri hsb - Upper Sorbian mk - Macedonian (FYROM) ka - Georgian fo - Faroese hi - Hindi mt - Maltese se - Sami (Northern) ga - Irish ms - Malay kk - Kazakh ky - Kyrgyz tk - Turkmen uz - Uzbek tt - Tatar bn - Bengali pa - Punjabi gu - Gujarati or - Oriya ta - Tamil te - Telugu kn - Kannada ml - Malayalam as - Assamese mr - Marathi sa - Sanskrit cy - Welsh lo - Lao gl - Galician kok - Konkani syr - Syriac iu - Inuktitut am - Amharic tzm - Tamazight fy - Frisian ha - Hausa yo - Yoruba quz - Quechua ba - Bashkir lb - Luxembourgish kl - Greenlandic ig - Igbo arn - Mapudungun br - Breton mi - Maori oc - Occitan co - Corsican gsw - Alsatian qut - K'iche wo - Wolof gd - Scottish Gaelic bg-BG - Bulgarian (Bulgaria) ca-ES - Catalan (Catalan) cs-CZ - Czech (Czech Republic) da-DK - Danish (Denmark) de-DE - German (Germany) el-GR - Greek (Greece) fi-FI - Finnish (Finland) fr-FR - French (France) he-IL - Hebrew (Israel) is-IS - Icelandic (Iceland) it-IT - Italian (Italy) nl-NL - Dutch (Netherlands) nb-NO - Norwegian, Bokmål (Norway) pt-BR - Portuguese (Brazil) rm-CH - Romansh (Switzerland) ro-RO - Romanian (Romania) ru-RU - Russian (Russia) hr-HR - Croatian (Croatia) sk-SK - Slovak (Slovakia) tr-TR - Turkish (Turkey) ur-PK - Urdu (Islamic Republic of Pakistan) id-ID - Indonesian (Indonesia) uk-UA - Ukrainian (Ukraine) be-BY - Belarusian (Belarus) sl-SI - Slovenian (Slovenia) et-EE - Estonian (Estonia) tg-Cyrl-TJ - Tajik (Cyrillic, Tajikistan) vi-VN - Vietnamese (Vietnam) hy-AM - Armenian (Armenia) az-Latn-AZ - Azeri (Latin, Azerbaijan) hsb-DE - Upper Sorbian (Germany) mk-MK - Macedonian (Former Yugoslav Republic of Macedonia) ka-GE - Georgian (Georgia) fo-FO - Faroese (Faroe Islands) hi-IN - Hindi (India) mt-MT - Maltese (Malta) se-NO - Sami, Northern (Norway) ms-MY - Malay (Malaysia) kk-KZ - Kazakh (Kazakhstan) ky-KG - Kyrgyz (Kyrgyzstan) tk-TM - Turkmen (Turkmenistan) uz-Latn-UZ - Uzbek (Latin, Uzbekistan) tt-RU - Tatar (Russia) bn-IN - Bengali (India) pa-IN - Punjabi (India) gu-IN - Gujarati (India) or-IN - Oriya (India) ta-IN - Tamil (India) te-IN - Telugu (India) kn-IN - Kannada (India) ml-IN - Malayalam (India) as-IN - Assamese (India) mr-IN - Marathi (India) sa-IN - Sanskrit (India) cy-GB - Welsh (United Kingdom) lo-LA - Lao (Lao P.D.R.) gl-ES - Galician (Galician) kok-IN - Konkani (India) syr-SY - Syriac (Syria) iu-Cans-CA - Inuktitut (Syllabics, Canada) am-ET - Amharic (Ethiopia) fy-NL - Frisian (Netherlands) ha-Latn-NG - Hausa (Latin, Nigeria) yo-NG - Yoruba (Nigeria) quz-BO - Quechua (Bolivia) ba-RU - Bashkir (Russia) lb-LU - Luxembourgish (Luxembourg) kl-GL - Greenlandic (Greenland) ig-NG - Igbo (Nigeria) arn-CL - Mapudungun (Chile) br-FR - Breton (France) mi-NZ - Maori (New Zealand) oc-FR - Occitan (France) co-FR - Corsican (France) gsw-FR - Alsatian (France) qut-GT - K'iche (Guatemala) wo-SN - Wolof (Senegal) gd-GB - Scottish Gaelic (United Kingdom) ar-IQ - Arabic (Iraq) de-CH - German (Switzerland) en-GB - English (United Kingdom) es-MX - Spanish (Mexico) fr-BE - French (Belgium) it-CH - Italian (Switzerland) nl-BE - Dutch (Belgium) nn-NO - Norwegian, Nynorsk (Norway) pt-PT - Portuguese (Portugal) sr-Latn-CS - Serbian (Latin, Serbia and Montenegro (Former)) sv-FI - Swedish (Finland) az-Cyrl-AZ - Azeri (Cyrillic, Azerbaijan) dsb-DE - Lower Sorbian (Germany) ga-IE - Irish (Ireland) ms-BN - Malay (Brunei Darussalam) uz-Cyrl-UZ - Uzbek (Cyrillic, Uzbekistan) bn-BD - Bengali (Bangladesh) iu-Latn-CA - Inuktitut (Latin, Canada) tzm-Latn-DZ - Tamazight (Latin, Algeria) quz-EC - Quechua (Ecuador) ar-EG - Arabic (Egypt) zh-HK - Chinese (Traditional, Hong Kong S.A.R.) de-AT - German (Austria) en-AU - English (Australia) es-ES - Spanish (Spain, International Sort) sr-Cyrl-CS - Serbian (Cyrillic, Serbia and Montenegro (Former)) se-FI - Sami, Northern (Finland) quz-PE - Quechua (Peru) ar-LY - Arabic (Libya) zh-SG - Chinese (Simplified, Singapore) de-LU - German (Luxembourg) en-CA - English (Canada) es-GT - Spanish (Guatemala) fr-CH - French (Switzerland) hr-BA - Croatian (Latin, Bosnia and Herzegovina) smj-NO - Sami, Lule (Norway) ar-DZ - Arabic (Algeria) zh-MO - Chinese (Traditional, Macao S.A.R.) de-LI - German (Liechtenstein) en-NZ - English (New Zealand) es-CR - Spanish (Costa Rica) fr-LU - French (Luxembourg) bs-Latn-BA - Bosnian (Latin, Bosnia and Herzegovina) ar-MA - Arabic (Morocco) en-IE - English (Ireland) fr-MC - French (Monaco) sr-Latn-BA - Serbian (Latin, Bosnia and Herzegovina) sma-NO - Sami, Southern (Norway) ar-TN - Arabic (Tunisia) es-DO - Spanish (Dominican Republic) sr-Cyrl-BA - Serbian (Cyrillic, Bosnia and Herzegovina) ar-OM - Arabic (Oman) en-JM - English (Jamaica) es-VE - Spanish (Bolivarian Republic of Venezuela) bs-Cyrl-BA - Bosnian (Cyrillic, Bosnia and Herzegovina) sms-FI - Sami, Skolt (Finland) ar-YE - Arabic (Yemen) es-CO - Spanish (Colombia) sr-Latn-RS - Serbian (Latin, Serbia) smn-FI - Sami, Inari (Finland) ar-SY - Arabic (Syria) en-BZ - English (Belize) es-PE - Spanish (Peru) sr-Cyrl-RS - Serbian (Cyrillic, Serbia) ar-JO - Arabic (Jordan) en-TT - English (Trinidad and Tobago) es-AR - Spanish (Argentina) sr-Latn-ME - Serbian (Latin, Montenegro) ar-LB - Arabic (Lebanon) es-EC - Spanish (Ecuador) sr-Cyrl-ME - Serbian (Cyrillic, Montenegro) ar-KW - Arabic (Kuwait) es-CL - Spanish (Chile) ar-AE - Arabic (U.A.E.) es-UY - Spanish (Uruguay) ar-BH - Arabic (Bahrain) es-PY - Spanish (Paraguay) ar-QA - Arabic (Qatar) en-IN - English (India) es-BO - Spanish (Bolivia) en-MY - English (Malaysia) es-SV - Spanish (El Salvador) en-SG - English (Singapore) es-HN - Spanish (Honduras) es-NI - Spanish (Nicaragua) es-PR - Spanish (Puerto Rico) bs-Cyrl - Bosnian (Cyrillic) bs-Latn - Bosnian (Latin) sr-Cyrl - Serbian (Cyrillic) sr-Latn - Serbian (Latin) smn - Sami (Inari) az-Cyrl - Azeri (Cyrillic) sms - Sami (Skolt) nn - Norwegian (Nynorsk) bs - Bosnian az-Latn - Azeri (Latin) uz-Cyrl - Uzbek (Cyrillic) iu-Cans - Inuktitut (Syllabics) zh-Hant - Chinese (Traditional) nb - Norwegian (Bokmål) sr - Serbian tg-Cyrl - Tajik (Cyrillic) dsb - Lower Sorbian uz-Latn - Uzbek (Latin) iu-Latn - Inuktitut (Latin) tzm-Latn - Tamazight (Latin) ha-Latn - Hausa (Latin) zh-CHT - Chinese (Traditional) Legacy |
2/1/1960 12:00:00 AM | th - Thai th-TH - Thai (Thailand) |
11/17/1982 12:00:00 AM | ps - Pashto dv - Divehi prs - Dari ps-AF - Pashto (Afghanistan) dv-MV - Divehi (Maldives) prs-AF - Dari (Afghanistan) |
2/3/2001 12:00:00 AM | zh-Hans - Chinese (Simplified) hu - Hungarian ja - Japanese ko - Korean pl - Polish sq - Albanian sv - Swedish lv - Latvian lt - Lithuanian eu - Basque tn - Setswana xh - isiXhosa zu - isiZulu af - Afrikaans mn - Mongolian bo - Tibetan km - Khmer si - Sinhala nso - Sesotho sa Leboa ii - Yi ug - Uyghur zh-TW - Chinese (Traditional, Taiwan) hu-HU - Hungarian (Hungary) ja-JP - Japanese (Japan) ko-KR - Korean (Korea) pl-PL - Polish (Poland) sq-AL - Albanian (Albania) sv-SE - Swedish (Sweden) lv-LV - Latvian (Latvia) lt-LT - Lithuanian (Lithuania) eu-ES - Basque (Basque) tn-ZA - Setswana (South Africa) xh-ZA - isiXhosa (South Africa) zu-ZA - isiZulu (South Africa) af-ZA - Afrikaans (South Africa) mn-MN - Mongolian (Cyrillic, Mongolia) bo-CN - Tibetan (PRC) km-KH - Khmer (Cambodia) si-LK - Sinhala (Sri Lanka) nso-ZA - Sesotho sa Leboa (South Africa) ii-CN - Yi (PRC) ug-CN - Uyghur (PRC) zh-CN - Chinese (Simplified, PRC) se-SE - Sami, Northern (Sweden) mn-Mong-CN - Mongolian (Traditional Mongolian, PRC) fr-CA - French (Canada) smj-SE - Sami, Lule (Sweden) en-ZA - English (South Africa) sma-SE - Sami, Southern (Sweden) zh - Chinese sma - Sami (Southern) mn-Cyrl - Mongolian (Cyrillic) smj - Sami (Lule) mn-Mong - Mongolian (Traditional Mongolian) zh-CHS - Chinese (Simplified) Legacy |
11/16/1982 12:00:00 AM | ar - Arabic ar-SA - Arabic (Saudi Arabia) |
I hope someone might find this information useful.