Solved

CTime::Format()  and regional settings

Posted on 1998-08-24
3
419 Views
Last Modified: 2013-11-19
Is there a way to access the Windows time/date regional settings when you are creating a format string?  For instance, my date format might be "4 Aug 98" but someone in the States might use "8/4/1998."  and it seems the same code ought to figure this out and adjust its results.
0
Comment
Question by:standefe
  • 3
3 Comments
 
LVL 7

Accepted Solution

by:
psdavis earned 180 total points
Comment Utility
Sure.  There's a whole system of 'locales' to deal with this.  Try:

GetDateFormat  
The GetDateFormat function formats a date as a date string for a specified locale. The function formats either a specified date or the local system date.

int GetDateFormat( LCID Locale,
 // locale for which date is to be formatted
 
DWORD dwFlags,
 // flags specifying function options
 
CONST SYSTEMTIME *lpDate,
 // date to be formatted
 
LPCTSTR lpFormat,
 // date format string
 
LPTSTR lpDateStr,
 // buffer for storing formatted string
 
int cchDate
 // size of buffer
 
);

Phillip  



0
 
LVL 7

Expert Comment

by:psdavis
Comment Utility
There's a real good discussion in the 'Going Global' site from Microsoft.

http://www.windows.com/globaldev/gbl-gen/nlsuppor.htm


0
 
LVL 7

Expert Comment

by:psdavis
Comment Utility
And another with an example on how to display today's date in the current locale.  There's also a small sample code at the site as well.

http://www.windows.com/globaldev/gbl-gen/nls.htm

Also, don't forget to look for the Microsoft Press® book Developing International Software.  I found it very helpful but was disappointed to see the far-east character tables used as filler.

Good Luck

Phillip


0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now