获取英文完整月份名称 [英] Get the complete month name in English
本文介绍了获取英文完整月份名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我为了得到当前月份的全名使用DateTime.Now.ToString(MMMM)。它运作良好,但我得到它的希伯来语。有没有办法控制输出语言的选项?我需要它是英文
I use DateTime.Now.ToString("MMMM") in order to get the current month's full name. It works well, but I get it in Hebrew. Is there an option to control the output language? I need it to be English
推荐答案
您可以通过一个的CultureInfo
对象作为参数则DateTime.ToString()
:
You can pass a CultureInfo
object as an argument DateTime.ToString()
:
CultureInfo ci = new CultureInfo("en-US");
var month = DateTime.Now.ToString("MMMM", ci);
// alternatively you can use CultureInfo.InvariantCulture:
var month = DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture);
这篇关于获取英文完整月份名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文