I'm trying to format a date to look this way: "day mm/dd/yyyy" for that I'm using something like : "dddd, " + dateFormatInfo.ShortDatePatternThe thing is ShortDatePattern does seem to be specific to the current culture info. for example I'm getting:fr_FR : Lundi 27/06/2011gb_GB : Monday 27/06/2011 when it should be Monday 06/27/2011I hope I'm being clear.

[Update]I wanted the string to update automatically between "dd/mm/yyyy" and "mm/dd/yyyy" depending on the current culture and i thought ShortDatePattern didn't do the trick but it actually does! it's just that in en_GB it's still "dd/mm/yyyy"[/update]

[Resolved]
DateTime date;
date.ToString("dddd, " + CurrentCultureInfo.DateTimeFormat.ShortDatePattern);

2

Best Answer


If you always want the date pattern to be MM/dd/yyyy, then specify that:

string format = "dddd, MM/dd/yyyy";

Note that the "/" part is also locale-specific; if you want it to always be a forward-slash, you should escape it:

string format = "dddd, MM'/'dd'/'yyyy";

If that's not what you were looking for, please update your question to make it clear exactly what you're doing (with sample code), the result you're getting, and the result you want.

You can use the following:

DateTime date;date.ToString("dddd, MM/dd/yyyy");