c# - Datetime string formatting and CultureInfo -
i suprised see fxcop complaining wasn't specifying cultureinfo in following:
string s = day.tostring("ddd");
surely format string param in tostring
independent of cultureinfo
? there way cultureinfo
affect returned string?
edit: sorry, total fail of question. it's obvious "ddd"
should dependent on culture settings. thinking more of case datetime.now.tostring("dd-mm-yy")
, looks fxcop doesn't in fact complain in instance.
there article on msdn on how extract day of week specific date. find many different examples on culture on page, including one:
datetime datevalue = new datetime(2008, 6, 11); console.writeline(datevalue.tostring("ddd")); // displays wed datetime datevalue = new datetime(2008, 6, 11); console.writeline(datevalue.tostring("ddd", new cultureinfo("fr-fr"))); // displays mer.
Comments
Post a Comment