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:
TDateSuffix and TMonthName are descriptors
A TDateSuffix object can contain a maximum of 4 characters
A TMonthName object can contain a maximum of 32 characters
In this example, both objects are constructed with a TInt value representing the day number within the month for the TDateSuffix object, and the month number for the TMonthName object. Both numbers are values offset from zero.
The numbers are used to generate the appropriate text. For example, for a TDateSuffix object, a value of zero gives "st", (first day of the month), one gives "nd" etc.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.