如何从C#中的希伯来日历中获取英文月份名称

Mar*_*rkF 5 c# datetime

我想用C#输出英文的希伯来日历日期.以下以希伯来语输出日期:

    var ci = System.Globalization.CultureInfo.CreateSpecificCulture("he-IL");
    ci.DateTimeFormat.Calendar = new System.Globalization.HebrewCalendar();
    Response.Write(DateTime.Today.ToString("MMM d, yyyy", ci));
    Response.Write(DateTime.Today.ToString("d-M-y", ci));
Run Code Online (Sandbox Code Playgroud)

???? ?"?, ???"?
?"?-?'-???"?
Run Code Online (Sandbox Code Playgroud)

2014年12月18日.将CultureInfo更改为"en-US"会引发"不是针对特定文化的有效日历".错误.我想要得到

26 Kislev 5775
Run Code Online (Sandbox Code Playgroud)

26-09-5775
Run Code Online (Sandbox Code Playgroud)

pio*_*ojo 0

我知道这不是一个理想的答案,但您可以手动输入希伯来月份列表,并用作DateTime.Today.Month该列表的索引。同样,DateTime.Today.Day.Year给出您可以使用的整数输出。抱歉,自行调整格式似乎有点不对,不是吗?

您仍然可以使用它string.format()来确保它看起来像您想要的那样。