.NET: Local date format from language tag/culture?
Given a CultureInfo object or language tag (e.g. "en-US") string, is there a function that will give me the default DateTime string format (e.g. "mm/dd/yyyy") 开发者_Go百科for that specific culture/language?
For example:
// Display using pt-BR culture's short date format
// dd/MM/yyyy
CultureInfo culture = new CultureInfo("pt-BR");
Console.WriteLine(culture.DateTimeFormat.ShortDatePattern);
// Display using pt-BR culture's full date time pattern
// dddd, d' de 'MMMM' de 'yyyy HH:mm:ss´
Console.WriteLine(culture.DateTimeFormat.FullDateTimePattern);
精彩评论