CString Format( LPCSTR pFormat ) const;
CString Format( LPCTSTR pFormat ) const;
CString Format( UINT nID ) const;
Return Value
A CString object that contains the formatted time.
Parameters
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 value and meaning of the formatting codes for Format are listed below:
nID
The ID of the string that identifies this format.
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 list above.
Example
// example for CTimeSpan::Format
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" );