CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008
    Posts
    62

    Unhappy how to get the system as a string

    Hi,

    I want to get the current system's time as a string for further manipulation.

    Can you give me a code for that ?

    Thanks
    Riyas.B
    Growing Developer

  2. #2
    Join Date
    May 2006
    Location
    Dresden, Germany
    Posts
    458

    Re: how to get the system as a string

    Quote Originally Posted by riyrse View Post
    Hi,

    I want to get the current system's time as a string for further manipulation.

    Can you give me a code for that ?

    Thanks
    Riyas.B
    Growing Developer
    You can use strftime, wcsftime (or using MFC you can use the CTime class and it's method called FormatGMT which is similar to strftime).

    The detailed description you can find in the MSDN.

    With regards
    Programartist

  3. #3
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: how to get the system as a string

    Code:
    CTime clTime = CTime::GetCurrentTime ();
    CString clTimeString;
    
    clTimeString.Format ("%02d:%02d%02d", clTime.GetHour (), clTime.GetMinute (), clTime.GetSecond ());

  4. #4
    Join Date
    May 2006
    Location
    Norway
    Posts
    1,709

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured