Get regional settings using MFC

Posted on 2008-11-06
Last Modified: 2013-12-14
I am working on an international application and need to be able to check the user's regional options for

Time separator
AM symbol
PM symbol

Can someone show me how to do this with MFC?  I am using Visual C++ Version 6.

Question by:richardpeters
    LVL 30

    Accepted Solution

    Hi richardpeters,

    you can use the 'GetLocaleInfo' function.

    As first arg you pass 'LOCALE_USER_DEFAULT' to get info about the user's settings.

    As second arg pass one of these:

    - LOCALE_ITIME: The result string is '0' if AM/PM is active, if 24-hour time is active it's '1'
    - LOCALE_S1159: The symbol for 'AM'
    - LOCALE_S2359: The symbol for 'PM'
    - LOCALE_STIME: The time seperator
    - LOCALE_STIMEFORMAT: The time format string

    Hope that helps,


    Author Closing Comment

    Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    779 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