Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get day/month text from Win32

Posted on 1998-05-22
10
Medium Priority
?
349 Views
Last Modified: 2013-12-03
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?
0
Comment
Question by:dnavarro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 1403551
C:\WINDOWS\SYSTEM\LOCALE.NLS is where most of the language dependent stuff is stored.
0
 
LVL 1

Author Comment

by:dnavarro
ID: 1403552
How do you access it from the API?  Or can you?
0
 
LVL 32

Expert Comment

by:jhance
ID: 1403553
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
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 1

Author Comment

by:dnavarro
ID: 1403554
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
 
LVL 23

Expert Comment

by:chensu
ID: 1403555
The first parameter LCID Locale of GetDateFormat() is for you to specify the locale. Thus, you can get the names of other languages.
0
 
LVL 1

Author Comment

by:dnavarro
ID: 1403556
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
 
LVL 11

Accepted Solution

by:
mikeblas earned 80 total points
ID: 1403557
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
 
LVL 1

Author Comment

by:dnavarro
ID: 1403558
That's exactly the answer I was looking for.  It works like a charm, thanks very much.

--Dave
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1403559
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
 
LVL 23

Expert Comment

by:chensu
ID: 1403560
The EnumCalendarInfo and EnumCalendarInfoEx functions may also be useful for you.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question