469,271 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

How to get name of month

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
Nov 21 '05 #1
34 9035
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

Nov 21 '05 #2
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

Nov 21 '05 #3
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?

Nov 21 '05 #4
* "Jared" <VB***********@email.com> scripsit:
Your code worked fine for me.
'Condensed version
Dim c As New CultureInfo("he-IL")
MessageBox.Show(c.DateTimeFormat.GetMonthName(Now. Month))


I get something I am not able to read and translate to Roman letters
:-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5
You're right, I too get something; I don't know if it's correct, the method
didn't fail, good enough for me.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O1**************@TK2MSFTNGP11.phx.gbl...
* "Jared" <VB***********@email.com> scripsit:
Your code worked fine for me.
'Condensed version
Dim c As New CultureInfo("he-IL")
MessageBox.Show(c.DateTimeFormat.GetMonthName(Now. Month))


I get something I am not able to read and translate to Roman letters
:-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #6
I am not sure if you saw my post just below your reply, the timestamp
on it is 15:35. I explained that

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

cannot return the correct name because within this expression
there is no TimeDate information. I was just wondering why
GetMonthName was not included in the DateTime object,
perhaps I am doing something wrong... It's not a bug, maybee
a design bug, but not an implementation bug.

B.t.w. if you want to see hebrew text you need to add the
hebrew keyboard in the control panel, it's as easy as 1,2,3.
"Jared" <@vb***********@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
You're right, I too get something; I don't know if it's correct, the method didn't fail, good enough for me.

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:O1**************@TK2MSFTNGP11.phx.gbl...
* "Jared" <VB***********@email.com> scripsit:
Your code worked fine for me.
'Condensed version
Dim c As New CultureInfo("he-IL")
MessageBox.Show(c.DateTimeFormat.GetMonthName(Now. Month))


I get something I am not able to read and translate to Roman letters
:-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #7
* "Jared" <@vb***********@hotmail.com> scripsit:
You're right, I too get something; I don't know if it's correct, the method
didn't fail, good enough for me.


OK, the same for me.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #8
Prosoft,

I gave you an answer earlier than any other? What is wrong with that, when I
do it like this I get it even in what I think is Herbrew (??????)

Me.Textbox1.text = Now.ToString("MMMM", New
System.Globalization.CultureInfo("he-IL"))
Cor
I am not sure if you saw my post just below your reply, the timestamp
on it is 15:35. I explained that

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

cannot return the correct name because within this expression
there is no TimeDate information. I was just wondering why
GetMonthName was not included in the DateTime object,
perhaps I am doing something wrong... It's not a bug, maybee
a design bug, but not an implementation bug.

B.t.w. if you want to see hebrew text you need to add the
hebrew keyboard in the control panel, it's as easy as 1,2,3.

Nov 21 '05 #9
ספטמבר
Nov 21 '05 #10
* "Cor Ligthert" <no**********@planet.nl> scripsit:

ספ~`ר


Huh!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #11
> > 


ספ~`ר


Huh!

I sand it in this case as HTML, maybe your Hamster does not see that.


Nov 21 '05 #12
"Cor Ligthert" <no**********@planet.nl> schrieb:
ספ~`ר


Huh!

I sand it in this case as HTML, maybe your Hamster does not see that.


Really weird. gnus can deal with posts in HTML format normally...

On my machine, I get a different result:

??????

(I hope this will be posted correctly in text/plain format.)

--
Herfried K. Wagner [Microsoft MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #13
OK, that didn't work. Next turn:

??????

Which is actually the same as Cor posted.

It's interesting that there are other characters showing up in the
messagebox than those that get posted when being copied into a message using
OE.

--
Herfried K. Wagner [Microsoft MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #14
Proof,
The way I understand it is

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
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?

Nov 21 '05 #15
did you get
????
or something else ?

"Jared" <VB***********@email.com> wrote in message
news:10*************@corp.supernews.com...
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


Nov 21 '05 #16
Well done, your hebrew is working correctly, but what you are
getting from the code is 'September' written in hebrew, however,
there is another month you need to get called ????
This is the hebrew lunar month presently. Can you get it?

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl...
??????
Nov 21 '05 #17
nope, you need to install the hebrew keyboard if you want to
read/write hebrew. It only works on win2000/xp i.e. not win98/me

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eD***************@TK2MSFTNGP15.phx.gbl...
* "Cor Ligthert" <no**********@planet.nl> scripsit:

ספ~`ר


Huh!

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #18
I received ??????

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
did you get
????
or something else ?

"Jared" <VB***********@email.com> wrote in message
news:10*************@corp.supernews.com...
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
>
>



Nov 21 '05 #19
leta start again

Well done, your hebrew is working correctly, but what you are
getting from the code is 'September' written in hebrew, however,
there is another month you need to get called אלול
which is the hebrew lunar month presently. Can you get it?

Nov 21 '05 #20
* "prosoft" <ifyouneedmyemailpleaseask> scripsit:
nope, you need to install the hebrew keyboard if you want to
read/write hebrew. It only works on win2000/xp i.e. not win98/me


I have a German language system and I tried the code you and Jared
posted, and I see the output in hebrew. So it seems that the necessary
characters are available on my machine (Unicode). I copied the text and
pasted it into an OE message, but even in Unicode mode they didn't get
posted. BTW: I am using Windows XP Professional SP1.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #21
O.k.
I have just realised that you need to set in Outlook Express in the 'send'
tab to use 'mime' . You will know you are sending hebrew unicode
when you click the 'send' button if a popup window will ask you if you
want to send as 'unicode' or not.

Counting the number of question marks in the word you obtained,
you are getting what Cor is getting, which is ספטמבר . This is simply
September written in hebrew. It is not the current *hebrew* month,
which is at present אלול

"Jared" <@vb***********@hotmail.com> wrote in message
news:10*************@corp.supernews.com...
I received ??????

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
did you get
????
or something else ?

"Jared" <VB***********@email.com> wrote in message
news:10*************@corp.supernews.com...
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
>
>




Nov 21 '05 #22
Prosoft,

I do not know the Hebrewic calender so I took, "Now" you can change with any
date.

Cor
Nov 21 '05 #23
You need to set the mime, see my reply in this thread
timestamped 17:50

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:e5**************@TK2MSFTNGP10.phx.gbl...
* "prosoft" <ifyouneedmyemailpleaseask> scripsit:
nope, you need to install the hebrew keyboard if you want to
read/write hebrew. It only works on win2000/xp i.e. not win98/me


I have a German language system and I tried the code you and Jared
posted, and I see the output in hebrew. So it seems that the necessary
characters are available on my machine (Unicode). I copied the text and
pasted it into an OE message, but even in Unicode mode they didn't get
posted. BTW: I am using Windows XP Professional SP1.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Nov 21 '05 #24
Prosoft,
Lets try this again:

I think the problem is that HebrewCalendar does not consider 1 Sept 2004
(Gregorian) a Hebrew leap year. It does consider 1 Sept 2003 (Gregorian) a
Hebrew leap year.

To see what years it considered leap years I used:

Dim hebrewCalendar As New HebrewCalendar

For gregorianYear As Integer = 2000 To 2010
Dim sept09 As New DateTime(gregorianYear, 9, 1)
Dim hebrewYear As Integer = hebrewCalendar.GetYear(sept09)
Debug.WriteLine(hebrewCalendar.IsLeapYear(hebrewYe ar),
gregorianYear.ToString())
Next
I don't know enough about the Hebrew calendar to say whether or not
HebrewCalendar.IsLeapYear is returning the correct value or not. I don't see
anything in the Microsoft Knowledge Base.

I tested the above on .NET 1.1 without SP1.

Based on the above I could see where GetMonth returns different names trying
your code with:
Dim tstDT As New DateTime(2003, 9, 1) ' 1 sep' 2003
Dim tstDT As New DateTime(2004, 9, 1) ' 1 sep' 2004
Dim tstDT As New DateTime(2005, 9, 1) ' 1 sep' 2005
If you haven't you may also want to ask in the
microsoft.public.dotnet.internationalization newsgroup.

Hope this helps
Jay

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...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?

Nov 21 '05 #25
No, the problem is that

GetMonthName(x as integer)

always returns the same thing if x doesn't change.

But with

dim y as integer = myHebrewCalendar.GetMonth(someDateTime)

y can vary by 1 if y>6 because of the leap year,

so, for example, for the last hebrew month אלול y as above will
sometimes be assigned the value
y=12
and sometimes
y=13

Do you see?

This means we must test for a leap year before using

GetMonthName(x as integer)

otherwise we will get the wrong month name.

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
Prosoft,
Lets try this again:

I think the problem is that HebrewCalendar does not consider 1 Sept 2004
(Gregorian) a Hebrew leap year. It does consider 1 Sept 2003 (Gregorian) a
Hebrew leap year.

To see what years it considered leap years I used:

Dim hebrewCalendar As New HebrewCalendar

For gregorianYear As Integer = 2000 To 2010
Dim sept09 As New DateTime(gregorianYear, 9, 1)
Dim hebrewYear As Integer = hebrewCalendar.GetYear(sept09)
Debug.WriteLine(hebrewCalendar.IsLeapYear(hebrewYe ar),
gregorianYear.ToString())
Next
I don't know enough about the Hebrew calendar to say whether or not
HebrewCalendar.IsLeapYear is returning the correct value or not. I don't see anything in the Microsoft Knowledge Base.

I tested the above on .NET 1.1 without SP1.

Based on the above I could see where GetMonth returns different names trying your code with:
Dim tstDT As New DateTime(2003, 9, 1) ' 1 sep' 2003
Dim tstDT As New DateTime(2004, 9, 1) ' 1 sep' 2004
Dim tstDT As New DateTime(2005, 9, 1) ' 1 sep' 2005


If you haven't you may also want to ask in the
microsoft.public.dotnet.internationalization newsgroup.

Hope this helps
Jay

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
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?



Nov 21 '05 #26
Prosoft,

When I look at Internet it is 26 elul 5764 is that right?

Cor
Nov 21 '05 #27
Prosoft,
Did you try asking in microsoft.public.dotnet.internationalization
newsgroup?

As it appears you are the Hebrew Calendar expert in this newsgroup. :-|

No, the problem is that
GetMonthName(x as integer)
always returns the same thing if x doesn't change.
No! I would expect GetMonthName to always return the same thing if x doesn't
change! As DateTimeFormatInfo has no concept of what the date (year in this
case) is, nor should it.

If GetMonthName varies because of year, then I would expect year to be a
parameter to GetMonthName. Just like the Calendar.IsLeapMonth function.
Actually I'm surprised that DateTimeFormatInfo functions expect integers
instead of DateTime objects. However that may be an attempt to decouple
something...

I'm curious as to what VS.NET 2005 (Whidbey, due out in 2005) offers to
simplify this...

Again if you haven't I strongly suggest
microsoft.public.dotnet.internationalization newsgroup, as I would hope that
group has more people that actively work with Hebrew & other calendars.

Hope this helps
Jay
"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... No, the problem is that

GetMonthName(x as integer)

always returns the same thing if x doesn't change.

But with

dim y as integer = myHebrewCalendar.GetMonth(someDateTime)

y can vary by 1 if y>6 because of the leap year,

so, for example, for the last hebrew month ???? y as above will
sometimes be assigned the value
y=12
and sometimes
y=13

Do you see?

This means we must test for a leap year before using

GetMonthName(x as integer)

otherwise we will get the wrong month name.

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
Prosoft,
Lets try this again:

I think the problem is that HebrewCalendar does not consider 1 Sept 2004
(Gregorian) a Hebrew leap year. It does consider 1 Sept 2003 (Gregorian)
a
Hebrew leap year.

To see what years it considered leap years I used:

Dim hebrewCalendar As New HebrewCalendar

For gregorianYear As Integer = 2000 To 2010
Dim sept09 As New DateTime(gregorianYear, 9, 1)
Dim hebrewYear As Integer = hebrewCalendar.GetYear(sept09)
Debug.WriteLine(hebrewCalendar.IsLeapYear(hebrewYe ar),
gregorianYear.ToString())
Next
I don't know enough about the Hebrew calendar to say whether or not
HebrewCalendar.IsLeapYear is returning the correct value or not. I don't

see
anything in the Microsoft Knowledge Base.

I tested the above on .NET 1.1 without SP1.

Based on the above I could see where GetMonth returns different names

trying
your code with:
> Dim tstDT As New DateTime(2003, 9, 1) ' 1 sep' 2003
> Dim tstDT As New DateTime(2004, 9, 1) ' 1 sep' 2004
> Dim tstDT As New DateTime(2005, 9, 1) ' 1 sep' 2005


If you haven't you may also want to ask in the
microsoft.public.dotnet.internationalization newsgroup.

Hope this helps
Jay

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
>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?
>
>
>


Nov 21 '05 #28
????

And now I paste it is is as you want, .........................
Nov 21 '05 #29
אלול
Nov 21 '05 #30
Hi Jay,
Again if you haven't I strongly suggest
microsoft.public.dotnet.internationalization newsgroup, as I would hope that group has more people that actively work with Hebrew & other calendars.


What did you say yesterday?

I needed only ten minutes more.

:-))))

(Although this was the first time that I did something with that Hebrew
calendar)

Cor
Nov 21 '05 #31

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Om*************@TK2MSFTNGP09.phx.gbl...
Prosoft,
Did you try asking in microsoft.public.dotnet.internationalization
newsgroup?

As it appears you are the Hebrew Calendar expert in this newsgroup. :-|

No, the problem is that
GetMonthName(x as integer)
always returns the same thing if x doesn't change.
No! I would expect GetMonthName to always return the same thing if x

doesn't change! As DateTimeFormatInfo has no concept of what the date (year in this case) is, nor should it.

If GetMonthName varies because of year, then I would expect year to be a
parameter to GetMonthName. Just like the Calendar.IsLeapMonth function.
Actually I'm surprised that DateTimeFormatInfo functions expect integers
instead of DateTime objects. However that may be an attempt to decouple
something...
Ha Ha, talk about decoupling..., this is precisely what I am asking/saying
i.e., why is GetMonthName not part of DateTime or why does
DateTimeFormatInfo accept integers and DateTime object, this is it!!!!!!!!
I might just re-ask the question in

microsoft.public.dotnet.internationalization

Thanks.

I'm curious as to what VS.NET 2005 (Whidbey, due out in 2005) offers to
simplify this...

Again if you haven't I strongly suggest
microsoft.public.dotnet.internationalization newsgroup, as I would hope that group has more people that actively work with Hebrew & other calendars.

Hope this helps
Jay
"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
No, the problem is that

GetMonthName(x as integer)

always returns the same thing if x doesn't change.

But with

dim y as integer = myHebrewCalendar.GetMonth(someDateTime)

y can vary by 1 if y>6 because of the leap year,

so, for example, for the last hebrew month ???? y as above will
sometimes be assigned the value
y=12
and sometimes
y=13

Do you see?

This means we must test for a leap year before using

GetMonthName(x as integer)

otherwise we will get the wrong month name.

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message news:uS**************@TK2MSFTNGP10.phx.gbl...
Prosoft,
Lets try this again:

I think the problem is that HebrewCalendar does not consider 1 Sept 2004 (Gregorian) a Hebrew leap year. It does consider 1 Sept 2003 (Gregorian) a
Hebrew leap year.

To see what years it considered leap years I used:

Dim hebrewCalendar As New HebrewCalendar

For gregorianYear As Integer = 2000 To 2010
Dim sept09 As New DateTime(gregorianYear, 9, 1)
Dim hebrewYear As Integer = hebrewCalendar.GetYear(sept09)
Debug.WriteLine(hebrewCalendar.IsLeapYear(hebrewYe ar),
gregorianYear.ToString())
Next
I don't know enough about the Hebrew calendar to say whether or not
HebrewCalendar.IsLeapYear is returning the correct value or not. I don't
see
anything in the Microsoft Knowledge Base.

I tested the above on .NET 1.1 without SP1.

Based on the above I could see where GetMonth returns different names

trying
your code with:

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

If you haven't you may also want to ask in the
microsoft.public.dotnet.internationalization newsgroup.

Hope this helps
Jay

"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:uU**************@TK2MSFTNGP11.phx.gbl...
>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?
>
>
>



Nov 21 '05 #32
That's correct, see also www.hebcal.com
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Prosoft,

When I look at Internet it is 26 elul 5764 is that right?

Cor


Nov 21 '05 #33
Prosoft,

I was afraid of that,

My computer tells with the calendertest that it is this year not a leap year
however previous year. See what I made. However I have set the culture using
the threading, maybe that goes with your real settings to he-IL better.

Cor
Nov 21 '05 #34
prosoft,
Ha Ha, talk about decoupling..., this is precisely what I am asking/saying
i.e., why is GetMonthName not part of DateTime or why does
DateTimeFormatInfo accept integers and DateTime object, this is it!!!!!!!!
Was that a rhetorical question? :-)

As I stated I would expect DateTimeFormatInfo.GetMonthName to either accept
a DateTime object, or at the very least GetMonthName would accept both month
& year as a parameter. See below for why I am leaning toward month & year as
a parameter.

The DateTimeFormatInfo knows how to format DateTime objects, I can see why
there are two types. Two types keep DateTime small, plus it allows date &
time formatting settings to be shared.

DateTime is an immutable structure as its good to have full value semantics
on a Date/Time values, you do not want aliasing on DateTime values.

DateTimeFormatInfo is a not inheritable class, as there is no real behavior
that needs to change, other then what Calendar offers. Being a class allows
you to have a single instance of DateTimeFormatInfo used in many places, in
other words you want aliasing.

GetMonthName is more of a Formatting feature then a "value" feature, hence I
would leave it on DateTimeFormatInfo.

Calendar is a must inherit class, as you have different calendars
(Gregorian, Hebrew, Hindi) that have different behaviors (Leap months,
different leap days).

The one advantage of DateTimeFormatInfo class accepting integers is if any
one defines a true Date type and a true Time type, then DateTimeFormatInfo
can still be used.

The only real short coming I see is that GetMonthName is missing the year
parameter. Or we are missing how it is suppose to work...

A true Date type is a structure that contains only a Date value (no time
part).

A true Time type is a structure that contains only a Time value (no date
part).

AS/400, DB2, Oracle, and other larger data base systems have Time, Date, and
DateTime data types, unlike .NET & SQL Server which currently only have Date
& Time combined into a single type. (I'm not sure if SQL Server 2005 will
offer us Time & Date types, however with .NET CLR integration one should be
able to add Time & Date types).

Hope this helps
Jay
"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Om*************@TK2MSFTNGP09.phx.gbl...
Prosoft,
Did you try asking in microsoft.public.dotnet.internationalization
newsgroup?

As it appears you are the Hebrew Calendar expert in this newsgroup. :-|

> No, the problem is that
> GetMonthName(x as integer)
> always returns the same thing if x doesn't change.


No! I would expect GetMonthName to always return the same thing if x

doesn't
change! As DateTimeFormatInfo has no concept of what the date (year in

this
case) is, nor should it.

If GetMonthName varies because of year, then I would expect year to be a
parameter to GetMonthName. Just like the Calendar.IsLeapMonth function.
Actually I'm surprised that DateTimeFormatInfo functions expect integers
instead of DateTime objects. However that may be an attempt to decouple
something...


Ha Ha, talk about decoupling..., this is precisely what I am asking/saying
i.e., why is GetMonthName not part of DateTime or why does
DateTimeFormatInfo accept integers and DateTime object, this is it!!!!!!!!
I might just re-ask the question in

microsoft.public.dotnet.internationalization

Thanks.

I'm curious as to what VS.NET 2005 (Whidbey, due out in 2005) offers to
simplify this...

Again if you haven't I strongly suggest
microsoft.public.dotnet.internationalization newsgroup, as I would hope

that
group has more people that actively work with Hebrew & other calendars.

Hope this helps
Jay
"prosoft" <ifyouneedmyemailpleaseask> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
> No, the problem is that
>
> GetMonthName(x as integer)
>
> always returns the same thing if x doesn't change.
>
> But with
>
> dim y as integer = myHebrewCalendar.GetMonth(someDateTime)
>
> y can vary by 1 if y>6 because of the leap year,
>
> so, for example, for the last hebrew month ???? y as above will
> sometimes be assigned the value
> y=12
> and sometimes
> y=13
>
> Do you see?
>
> This means we must test for a leap year before using
>
> GetMonthName(x as integer)
>
> otherwise we will get the wrong month name.
>
> "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message > news:uS**************@TK2MSFTNGP10.phx.gbl...
>> Prosoft,
>> Lets try this again:
>>
>> I think the problem is that HebrewCalendar does not consider 1 Sept 2004 >> (Gregorian) a Hebrew leap year. It does consider 1 Sept 2003 (Gregorian) >> a
>> Hebrew leap year.
>>
>> To see what years it considered leap years I used:
>>
>> Dim hebrewCalendar As New HebrewCalendar
>>
>> For gregorianYear As Integer = 2000 To 2010
>> Dim sept09 As New DateTime(gregorianYear, 9, 1)
>> Dim hebrewYear As Integer = hebrewCalendar.GetYear(sept09)
>> Debug.WriteLine(hebrewCalendar.IsLeapYear(hebrewYe ar),
>> gregorianYear.ToString())
>> Next
>>
>>
>> I don't know enough about the Hebrew calendar to say whether or not
>> HebrewCalendar.IsLeapYear is returning the correct value or not. I don't > see
>> anything in the Microsoft Knowledge Base.
>>
>> I tested the above on .NET 1.1 without SP1.
>>
>> Based on the above I could see where GetMonth returns different names
> trying
>> your code with:
>>
>> > Dim tstDT As New DateTime(2003, 9, 1) ' 1 sep' 2003
>> > Dim tstDT As New DateTime(2004, 9, 1) ' 1 sep' 2004
>> > Dim tstDT As New DateTime(2005, 9, 1) ' 1 sep' 2005
>>
>> If you haven't you may also want to ask in the
>> microsoft.public.dotnet.internationalization newsgroup.
>>
>> Hope this helps
>> Jay
>>
>> "prosoft" <ifyouneedmyemailpleaseask> wrote in message
>> news:uU**************@TK2MSFTNGP11.phx.gbl...
>> >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?
>> >
>> >
>> >
>>
>>
>


Nov 21 '05 #35

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by wolftor | last post: by
6 posts views Thread by Edwin Knoppert | last post: by
2 posts views Thread by sachin shah | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.