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. How to change from WORD to CString

How to change from WORD to CString

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
5 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.
  • M Offline
    M Offline
    mr2003
    wrote on last edited by
    #1

    Hi, In my code, i read the system date with the following code, SYSTEMTIME systime; GetLocalTime ( &systime ); WORD day = systime.wDay; WORD month = systime.wMonth; WORD year = systime.wYear; now, I would like to store it in this format, day/month/year as CString,. how can I do that? Ehsan Behboudi

    J D T J 4 Replies Last reply
    0
    • M mr2003

      Hi, In my code, i read the system date with the following code, SYSTEMTIME systime; GetLocalTime ( &systime ); WORD day = systime.wDay; WORD month = systime.wMonth; WORD year = systime.wYear; now, I would like to store it in this format, day/month/year as CString,. how can I do that? Ehsan Behboudi

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      CString strDate; strData.Format(...); // works like printf INTP

      1 Reply Last reply
      0
      • M mr2003

        Hi, In my code, i read the system date with the following code, SYSTEMTIME systime; GetLocalTime ( &systime ); WORD day = systime.wDay; WORD month = systime.wMonth; WORD year = systime.wYear; now, I would like to store it in this format, day/month/year as CString,. how can I do that? Ehsan Behboudi

        D Offline
        D Offline
        Dominik Reichl
        wrote on last edited by
        #3

        WORD day = systime.wDay;
        WORD month = systime.wMonth;
        WORD year = systime.wYear;

        CString strDate;
        strDate.Format("%u/%u/%u", year, month, day);


        _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;) (doesn't work on NT)

        1 Reply Last reply
        0
        • M mr2003

          Hi, In my code, i read the system date with the following code, SYSTEMTIME systime; GetLocalTime ( &systime ); WORD day = systime.wDay; WORD month = systime.wMonth; WORD year = systime.wYear; now, I would like to store it in this format, day/month/year as CString,. how can I do that? Ehsan Behboudi

          T Offline
          T Offline
          Ted Ferenc
          wrote on last edited by
          #4

          In the MFC try CTime::Format or strftime for Win32


          "There is no monument dedicated to the memory of a committee." - Lester J. Pourciau

          1 Reply Last reply
          0
          • M mr2003

            Hi, In my code, i read the system date with the following code, SYSTEMTIME systime; GetLocalTime ( &systime ); WORD day = systime.wDay; WORD month = systime.wMonth; WORD year = systime.wYear; now, I would like to store it in this format, day/month/year as CString,. how can I do that? Ehsan Behboudi

            J Offline
            J Offline
            John M Drescher
            wrote on last edited by
            #5

            I agree with the previous poster. If you are using MFC either use CTime or COleDateTime and they both have a function to convert the time to a string in whatever format you need. John

            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