开发者

.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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜