Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CTimeSpan::Format
CTimeSpan                                   Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  CString Format( const char* pFormat );
 
  Parameter   Description
 
  <pFormat>   A formatting string similar to the printf formatting string.
              Formatting codes, preceded by a percent (%) sign, are
              replaced by the corresponding CTimeSpan component. Other
              characters in the formatting string are copied unchanged to
              the returned string.
 
              The formatting codes for Format are listed below:
 
              Value   Meaning
 
              %D       Total days in this CTimeSpan
 
              %H       Hours in the current day
 
              %M       Minutes in the current hour
 
              %S       Seconds in the current minute
 
              %%        Percent sign
 
  Remarks
 
  Generates a formatted string that corresponds to this CTimeSpan.
 
  The Debug version of the library checks the formatting codes and asserts
  if the code is not in the table above.
 
  Return Value
 
  A CString object that contains the formatted time.
 
  Example
 
  CTimeSpan ts( 3, 1, 5, 12 ); // 3 days, 1 hour, 5 min, and 12 sec
  CString s = ts.Format( "Total days: %D, hours: %H, mins: %M, secs: %S" );
  ASSERT( s == "Total days: 3, hours: 01, mins: 05, secs: 12" );
 
 
 
                                     -♦-