views:

55

answers:

1

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") for that specific culture/language?

+2  A: 

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);
Leniel Macaferi