TInternetDate
class stores the date in universal
time and provides the functionality to parse internet style dates in different
formats into TDateTime
and RFC 1123 dates. This class
handles the 8-bit descriptors only.
TInternetDate
supports the parsing of the following
date formats:
Sun, 06 Nov 1994 08:49:37 GMT, RFC 822 and RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT, RFC 850
Sun Nov 6 08:49:37 1994 ANSI C's asctime()format
DateTime utilities provides the following time formats:
The following code fragment constructs a
TInternetDate
object from a TDateTime
object. It converts the date '2006,EJanuary,17,06,36,30,000000' to the text
form i.e. 'Wed, 17 Jan 2006 06:36:30 GMT'.
TDateTime time(2006,EJanuary,17,06,36,30,000000); //create a date time object
TInternetDate internetDate(time);
HBufC8* textDate = internetDate.InternetDateTimeL(TInternetDate::ERfc1123Format); //get the text form "Wed, 17 Jan 2006 06:36:30 GMT"
CleanupStack::PushL(textDate);
.................. //use textDate here
CleanupStack::PopAndDestroy(textDate);
Use TInternetDate::SetDateL()
to set the text from of
the date. construct a TInternetDate object [date string] from a desciptor which
contains date.
_LIT8(KTextDate, "Wed, 17 Jan 2006 06:36:30 GMT");
TInternetDate internetDate1;
internetDate1.SetDateL(KTextDate); //set date time, "Wed, 17 Jan 2006 06:36:30 GMT"
TDateTime time1 = internetDate1.DateTime(); // convert textDate to Date time format
The code fragment sets the text form of date, "Wed, 17 Jan 2006 06:36:30 GMT" and converts it to DateTime format.