Get day/month text from Win32

When you call GetDateFormat() to convert a date to a string, it will return the month and/or day of the week by name (ie:  Monday, May 5, 1998).  The names used are always country/locale specific rather than always english.
Where does Windows store this information?  I searched the registry but couldn't find it.  Is it a resource in a DLL?  If so, which one?
LVL 1
dnavarroAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jhanceCommented:
C:\WINDOWS\SYSTEM\LOCALE.NLS is where most of the language dependent stuff is stored.
0
dnavarroAuthor Commented:
How do you access it from the API?  Or can you?
0
jhanceCommented:
Maybe if you explained what you are trying to do it would help.  You asked where it was stored, and I told you that.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

dnavarroAuthor Commented:
I need to get the names of all the months and days of the weeks from Windows.  I don't want to just use english.  It's for a customized calendar control.
0
chensuCommented:
The first parameter LCID Locale of GetDateFormat() is for you to specify the locale. Thus, you can get the names of other languages.
0
dnavarroAuthor Commented:
I realize that, however I need to get *all* of the names of the months and days of the week, not just the current day/month name.

I suppose I could call GetDateFormat() twelve times to get the names of all the months and days of the week, but that seems kind silly if there's a more efficient way.

0
mikeblasCommented:
Check out the GetLocalInfo() API; it provides the names and format strings for anything that gets localized. (It's silly to go chasing down resources in a DLL when there's a perfectly good API to get what you want.)

char sz[1024];

if (!GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1, sz, 1024))
   printf("Something is really, really broken.\n");
else
   printf("The first month is %s\n", sz);

The online help for GetLocaleInfo() explains how to use MAKELANGID() for the first parameter if you want something other than the user default or the system default. The LOCALE_SMONTHNAME1 constant is a locale info type, and the online help enumerates all of the different values you can use for that guy.

Sorry, you still have to make 12 calls to get the 12 strings.

.B ekiM
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dnavarroAuthor Commented:
That's exactly the answer I was looking for.  It works like a charm, thanks very much.

--Dave
0
mikeblasCommented:
Remember that the first month or the first day might not be "January" or "Sunday", depending on the customs of the locale.

.B ekiM
0
chensuCommented:
The EnumCalendarInfo and EnumCalendarInfoEx functions may also be useful for you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.