?
Solved

Quickest way to get time to a string

Posted on 1999-12-11
1
Medium Priority
?
181 Views
Last Modified: 2010-04-01
Hello,
  I want to get the current time and place it in a char* or cstring.

such as 12:09 pm, or 12:09am.

what is the quickest way to do this?

thanks,
  jer
0
Comment
Question by:pipe
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 400 total points
ID: 2274765
CTime t = CTime::GetCurrentTime();
CString str = t.Format(_T("%I:%M%p"));
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question