Formatting Time Values: General-Purpose Classes

OverviewHow Do I

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 or 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?