如何获得月份名称 [英] How to get name of month

查看:67
本文介绍了如何获得月份名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用

Dim myDTFI As DateTimeFormatInfo = New CultureInfo(" he-IL",

True).DateTimeFormat

Dim strhmon1 As String =(myDTFI.GetMonthName(hmon1))

MsgBox(strhmon1)


我得到格里高利月的本地名称。

我如何获得当地月份的本地名称?


Tia

解决方案

Prosoft。

Now.ToString(" MMMM")

我希望这有帮助吗?


Cor



" prosoft" < ifyouneedmyemailpleaseask> schreef in bericht

news:ev ************** @ TK2MSFTNGP09.phx.gbl ...

当我使用
True).DateTimeFormat
Dim strhmon1 As String =(myDTFI.GetMonthName(hmon1))
MsgBox(strhmon1)

我得到了格里高利月的本地名称。
如何获得当地月份的本地名称?

Tia


你的代码对我来说很好。

''简化版

Dim c As New CultureInfo(" ; he-IL")

MessageBox.Show(c.DateTimeFormat.GetMonthName(Now。Month))


" prosoft" < ifyouneedmyemailpleaseask>在消息中写道

news:ev ************** @ TK2MSFTNGP09.phx.gbl ...

当我使用
True).DateTimeFormat
Dim strhmon1 As String =(myDTFI.GetMonthName(hmon1))
MsgBox(strhmon1)

我得到了格里高利月的本地名称。
如何获得当地月份的本地名称?

Tia


我收到错误的信息,这是一个错误吗?


Dim tstHCal As New HebrewCalendar

Dim tstDT As New DateTime(2004,9,1)''1 sep''2004

Dim hmonth As Integer = myHCal.GetMonth(tstDT)

Dim tstDTFI As DateTimeFormatInfo = New CultureInfo(" he-IL",

True)。DateTimeFormat

tstDTFI.Calendar = myHCal

Dim hmonthName As String =(tstDTFI.GetMonthName(hmonth))

MsgBox(hmonthName)


输出是Av

它应该是Elul因为1 sep''2004在'elul'中,见hebcal.com

我也可以看到发生了什么。通常是第12个月(如Gregorian

2004,9,1)

是elul但是当闰年月12时,av是av。并且第13个月是

" elul"。

问题是

Dim hmonthName As String =(tstDTFI.GetMonthName(hmonth))

无法知道它是否是闰年,所以它总是返回

a值,好像它是闰年。是应该这样吗?


When I use
Dim myDTFI As DateTimeFormatInfo = New CultureInfo("he-IL",
True).DateTimeFormat
Dim strhmon1 As String = (myDTFI.GetMonthName(hmon1))
MsgBox(strhmon1)

I get the local name of the gregorian month.
How do I get the local name of the local month ?

Tia

解决方案

Prosoft.
Now.ToString("MMMM")

I hope this helps?

Cor


"prosoft" <ifyouneedmyemailpleaseask> schreef in bericht
news:ev**************@TK2MSFTNGP09.phx.gbl...

When I use
Dim myDTFI As DateTimeFormatInfo = New CultureInfo("he-IL",
True).DateTimeFormat
Dim strhmon1 As String = (myDTFI.GetMonthName(hmon1))
MsgBox(strhmon1)

I get the local name of the gregorian month.
How do I get the local name of the local month ?

Tia



Your code worked fine for me.
''Condensed version
Dim c As New CultureInfo("he-IL")
MessageBox.Show(c.DateTimeFormat.GetMonthName(Now. Month))

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl...

When I use
Dim myDTFI As DateTimeFormatInfo = New CultureInfo("he-IL",
True).DateTimeFormat
Dim strhmon1 As String = (myDTFI.GetMonthName(hmon1))
MsgBox(strhmon1)

I get the local name of the gregorian month.
How do I get the local name of the local month ?

Tia



I am getting the wrong information, is it a bug?

Dim tstHCal As New HebrewCalendar
Dim tstDT As New DateTime(2004, 9, 1) '' 1 sep'' 2004
Dim hmonth As Integer = myHCal.GetMonth(tstDT)
Dim tstDTFI As DateTimeFormatInfo = New CultureInfo("he-IL",
True).DateTimeFormat
tstDTFI.Calendar = myHCal
Dim hmonthName As String = (tstDTFI.GetMonthName(hmonth))
MsgBox(hmonthName)

the output is "Av"
it should be "Elul" because 1 sep'' 2004 is in "elul" , see hebcal.com
I can see what is happening as well. Usually month 12 (as in Gregorian
2004,9,1)
is "elul" , but when there is a leap year month 12 is "av" and month 13 is
"elul".
The problem is that
Dim hmonthName As String = (tstDTFI.GetMonthName(hmonth))
has no way of knowing if it''s a leap year or not, so it always returns
a value as if it was a leap year. Is it supposed to be this way?


这篇关于如何获得月份名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆