How to

get localized day and month names

Published: 14. January 2009 | Updated: 11. October 2011
License: Microsoft Public License (MS-PL)
Categories: Globalization » Calendar
Tags: C# Globalization
Was this snippet helpful for you? YESYES / NONO

Import namespace

using System.Globalization;

Code

DateTimeFormatInfo info = DateTimeFormatInfo.GetInstance(CultureInfo.GetCultureInfo("cs-CZ"));

Console.WriteLine("Localized day names");
foreach (string day in info.DayNames)
{
    Console.WriteLine(day);
}

Console.WriteLine("Localized month names");
foreach (string month in info.MonthNames)
{
    Console.WriteLine(month);
}
Console Output:
Localized day names
nedele
pondelí
úterý
streda
ctvrtek
pátek
sobota

Localized month names
leden
únor
brezen
duben
kveten
cerven
cervenec
srpen
zárí
ríjen
listopad
prosinec
Send us feedback about this snippet »



Related Snippets: