Udostępnij za pośrednictwem


Formatting Time Values: General-Purpose Classes

The following procedure shows how to format time values.

To format a string representation of a time or elapsed time

  • Use the Format member function from either the CTime or CTimeSpan classes to create a character string representation of the time or elapsed time, as shown by the following example.

    CTime t( 1991, 3, 19, 22, 15, 0 );
    // 10:15PM March 19, 1991
    
    CString s = t.Format( "%A, %B %d, %Y" );
    // s == "Tuesday, March 19, 1991"    
    

What do you want to know more about?

See Also

Concepts

Date and Time: General-Purpose Classes