Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Time format

Time format

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AbhiHcl
    wrote on last edited by
    #1

    How to get the system Clock Style, I mean weather it 12 hr clock style or 24 hr clock style. Thanks.

    L E D 3 Replies Last reply
    0
    • A AbhiHcl

      How to get the system Clock Style, I mean weather it 12 hr clock style or 24 hr clock style. Thanks.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      The system clock does not have a style it is merely a counter used to calculate the current time since some predefined date. However any clock displays used in Windows will access the regional settings to determine how such times should be displayed. I am not sure of the simple way to access the details but you could take a look at the HKEY_CURRENT_USER\Control Panel\International registry key.

      It's time for a new signature.

      1 Reply Last reply
      0
      • A AbhiHcl

        How to get the system Clock Style, I mean weather it 12 hr clock style or 24 hr clock style. Thanks.

        E Offline
        E Offline
        Eugen Podsypalnikov
        wrote on last edited by
        #3

        Try it :) :

        bool GetTimeFormattedBySystem(const SYSTEMTIME& sSomeTime,
        CString& cszReceiver)
        {
        static const int iTimeStrLen(40);
        static TCHAR szResult[iTimeStrLen];

        cszReceiver.Empty();

        if (GetTimeFormat(LOCALE_USER_DEFAULT,
        0,
        &sSomeTime,
        NULL,
        szResult,
        iTimeStrLen)) {
        cszReceiver = szResult;
        }

        return (0 < cszReceiver.GetLength());
        }

        virtual void BeHappy() = 0;

        1 Reply Last reply
        0
        • A AbhiHcl

          How to get the system Clock Style, I mean weather it 12 hr clock style or 24 hr clock style. Thanks.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Have you tried GetLocaleInfo(LOCALE_ITIME)?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups