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. Calculating Date from Number of Seconds.

Calculating Date from Number of Seconds.

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
5 Posts 2 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
    megha_gharote
    wrote on last edited by
    #1

    Dear Friends, I need to calculate the future date from number of seconds available from now. Can anybody help me out? Which all classes i can use for this calculation?

    N 1 Reply Last reply
    0
    • M megha_gharote

      Dear Friends, I need to calculate the future date from number of seconds available from now. Can anybody help me out? Which all classes i can use for this calculation?

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      CTime and CTimeSpan ...

      CTimeSpan sPan(0,0,0, 86400 );// 1 day
      CTime CurTime = CTime::GetCurrentTime();
      CurTime += sPan;
      CString csTime = CurTime.Format(\_T("%A, %B %d, %Y"));
      AfxMessageBox( csTime );
      

      nave [OpenedFileFinder]

      modified on Tuesday, April 15, 2008 5:16 AM

      M 1 Reply Last reply
      0
      • N Naveen

        CTime and CTimeSpan ...

        CTimeSpan sPan(0,0,0, 86400 );// 1 day
        CTime CurTime = CTime::GetCurrentTime();
        CurTime += sPan;
        CString csTime = CurTime.Format(\_T("%A, %B %d, %Y"));
        AfxMessageBox( csTime );
        

        nave [OpenedFileFinder]

        modified on Tuesday, April 15, 2008 5:16 AM

        M Offline
        M Offline
        megha_gharote
        wrote on last edited by
        #3

        Thanks Naveen for such quick response. actually i have tried these two things but i dont need the number of days i directly want the date. For example from now if 24 hrs are there then i need date as 16 Apr. i dont want as 1 day. could you please help me out for this?

        N 1 Reply Last reply
        0
        • M megha_gharote

          Thanks Naveen for such quick response. actually i have tried these two things but i dont need the number of days i directly want the date. For example from now if 24 hrs are there then i need date as 16 Apr. i dont want as 1 day. could you please help me out for this?

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          I modified the post with example, pls check it. From CTime, you can get the date, not the number of days...

          nave [OpenedFileFinder]

          M 1 Reply Last reply
          0
          • N Naveen

            I modified the post with example, pls check it. From CTime, you can get the date, not the number of days...

            nave [OpenedFileFinder]

            M Offline
            M Offline
            megha_gharote
            wrote on last edited by
            #5

            Thank u so much.. it worked...

            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