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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Get system time

Get system time

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 5 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.
  • S Offline
    S Offline
    shamsteady
    wrote on last edited by
    #1

    How can i get the system time and display it?

    D E H 3 Replies Last reply
    0
    • S shamsteady

      How can i get the system time and display it?

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

      shamsteady wrote:

      How can i get the system time...

      Use GetSystemTime(), or time().

      shamsteady wrote:

      ...and display it?

      Use printf(), or cout.


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      S 1 Reply Last reply
      0
      • D David Crow

        shamsteady wrote:

        How can i get the system time...

        Use GetSystemTime(), or time().

        shamsteady wrote:

        ...and display it?

        Use printf(), or cout.


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        S Offline
        S Offline
        shamsteady
        wrote on last edited by
        #3

        It said GetSystemTime() is undeclared. Am i missing something?

        D T 2 Replies Last reply
        0
        • S shamsteady

          It said GetSystemTime() is undeclared. Am i missing something?

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

          shamsteady wrote:

          Am i missing something?

          Yes, the inclusion of a header file.


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          1 Reply Last reply
          0
          • S shamsteady

            How can i get the system time and display it?

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #5

            Also, you can use the time_t structure.

            time_t t;
            time(&t);
            cout<


            Press: 1500 to 2,200 messages in just 6 days? How's that possible sir?
            **Dr.Brad :**Well,I just replied to everything Graus did and then argued with Negus for a bit.

            1 Reply Last reply
            0
            • S shamsteady

              It said GetSystemTime() is undeclared. Am i missing something?

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              shamsteady wrote:

              Yes, the inclusion of a header file.

              shamsteady wrote:

              t said GetSystaremTime() is undeclared. Am i missing something?

              which compiler are you using@!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta Global Interface Table: An Easy Way to Marshal an Interface Pointer[new] VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

              1 Reply Last reply
              0
              • S shamsteady

                How can i get the system time and display it?

                H Offline
                H Offline
                Hamid Taebi
                wrote on last edited by
                #7

                See

                SYSTEMTIME m_SysTime;
                char DisplayTime[255];
                ::GetSystemTime(&m_SysTime);
                sprintf(DisplayTime,"%d/%d/%d...%d::%d::%d::%d",
                m_SysTime.wMonth,m_SysTime.wDay,
                m_SysTime.wYear,m_SysTime.wHour,
                m_SysTime.wMinute,m_SysTime.wSecond,m_SysTime.wMilliseconds);


                WhiteSky


                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