How to

get abbreviated day names

Published: 12. October 2011 | Updated: 12. 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

var culture = CultureInfo.GetCultureInfo("en-US");
var dateTimeInfo = DateTimeFormatInfo.GetInstance(culture);

// 3 letters abbreviations
foreach (string abbreviatedDayName in dateTimeInfo.AbbreviatedDayNames)
{
    Console.WriteLine(abbreviatedDayName);
}

Console.WriteLine();

// 2 letters abbreviations
foreach (string shortestDayName in dateTimeInfo.ShortestDayNames)
{
    Console.WriteLine(shortestDayName);
}
Console Output:
Sun
Mon
Tue
Wed
Thu
Fri
Sat

Su
Mo
Tu
We
Th
Fr
Sa
Send us feedback about this snippet »



Related Snippets: