How to get name of month

H

Herfried K. Wagner [MVP]

* "prosoft said:
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.
 
P

prosoft

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 ×לול
 
C

Cor Ligthert

Prosoft,

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

Cor
 
J

Jay B. Harlow [MVP - Outlook]

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(hebrewYear),
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
 
P

prosoft

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.
 
J

Jay B. Harlow [MVP - Outlook]

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
 
C

Cor Ligthert

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
 
P

prosoft

Jay B. Harlow said:
Prosoft,
Did you try asking in microsoft.public.dotnet.internationalization
newsgroup?

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



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.
 
C

Cor Ligthert

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
 
J

Jay B. Harlow [MVP - Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top