First public contribution.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // This file contains implementation for classes defined in tinternetdate.h
19 @file tinternetdate.cpp
24 #include "tinternetdate.h"
25 #include "inetprottextutils.h"
26 #include "tinternetdateparser.h"
30 Used to set a date which is in a Internet form.
33 @param aDate the text form of the date .
34 @leave KErrCorrupt, if the date is not in the correct format
36 EXPORT_C void TInternetDate::SetDateL(const TDesC8& aDate)
38 TInternetDateParser dateParser;
40 TPtrC8 datePtr(aDate);
41 // Remove the any leading and trailing whitespaces from the date.
42 InetProtTextUtils::RemoveWhiteSpace(datePtr, InetProtTextUtils::ERemoveBoth);
44 dateParser.ConvertFromInternetFormL(datePtr, iDateTime);
48 Used to access the date/time
51 @return const TDateTime& The time stored in this object
53 EXPORT_C const TDateTime& TInternetDate::DateTime()
59 Used to access the date/time in a text formate
62 @param aInternetDateFormat The format of the date. Only RFC1123 dates are supported
63 @return HBufC8* A descriptor containing the date/time in the format
64 specifed by the parameter aInternetDateFormat
67 EXPORT_C HBufC8* TInternetDate::InternetDateTimeL(TInternetDateFormat /*aInternetDateFormat*/)
69 TInternetDateParser dateParser;
70 return dateParser.ConvertToRfc1123FormL(iDateTime);