I've a datetime:
DateTime dt = new DateTime(2003, 5, 1);
dt.DayOfWeek // returns Thursday
How I can split only first three characters from DayOfWeek
e.g. Thu
?
If you mean for it to work in different cultures, then your best bet is probably:
var abbr = culture.DateTimeFormat.GetAbbreviatedDayName(dayOfWeek);
where culture
is a CultureInfo
, for example:
var culture = CultureInfo.CurrentCulture;
In English cultures, this is the 3-letter version:
Sun
Mon
Tue
Wed
Thu
Fri
Sat