Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to format date as text

The following code fragment formats the day number, date suffix and month name as text into a supplied descriptor. The function in the code fragment assumes that the descriptor is sufficiently big:

void formatDateTime(TDes& aBuffer,TDateTime aDateTime)
    {
    _LIT(KFormatTxt,"Date as text: %d%S %S\n");
    aBuffer.Format(KFormatTxt,aDateTime.Day()+1,&(TDateSuffix(aDateTime.Day())),&(TMonthName(aDateTime.Month())));
    }

Note the following: