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. MFC - Displaying time in dialog

MFC - Displaying time in dialog

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
3 Posts 3 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
    Ashman
    wrote on last edited by
    #1

    Hey I need to know how to display the system date and time in a static control in format: Day, Date, Time, AM/PM. Can someone please help me, this is a fundamental aspect to my program. Thankyou Ashman

    M T 2 Replies Last reply
    0
    • A Ashman

      Hey I need to know how to display the system date and time in a static control in format: Day, Date, Time, AM/PM. Can someone please help me, this is a fundamental aspect to my program. Thankyou Ashman

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      have a look at strtime and strdate and related functions to create a formated string of a time and a date. and to put it on the dialog, create a CStatic and use SetWindowText.


      Maximilien Lincourt Your Head A Splode - Strong Bad

      1 Reply Last reply
      0
      • A Ashman

        Hey I need to know how to display the system date and time in a static control in format: Day, Date, Time, AM/PM. Can someone please help me, this is a fundamental aspect to my program. Thankyou Ashman

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        you can do this like that :

        CTime t1;
        t1=CTime::GetCurrentTime();
        ((CStatic*)GetDlgItem(YOUR_STATIC_ID))->SetWindowText((LPCTSTR)t1.Format("%H:%M:%S"));

        that would be running... TOXCCT

        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