magol
magol

Reputation: 6273

Why is not the day of the week formated in long date format for all languages?

We have used date.ToString ("D") for formatting the date. But when we globalizat the application to other languages ​​we encounter problems. We expect the day of the week to appear when we use the long date format, but it's not lake so for all languages. According http://www.basicdatepicker.com/samples/cultureinfo.aspx, it is far from all language that print out day a week for the long date format. How should we do to format the date?

Upvotes: 0

Views: 286

Answers (1)

RJ Lohan
RJ Lohan

Reputation: 6527

If you need an explicit format, specify it like so;

DateTime date = DateTime.Now;
string s = date.ToString("dddd, dd MMMM yyyy");

According to the MSDN doco, the "D" format specifier is affected by the Calendar, which is Culture specific.

You shouldn't make assumptions about string formatting or Date display in particular, when internationalising.

Upvotes: 2

Related Questions