_LIT8( KEuropeLondon,"Europe/London" );
// Create a pointer to the time zone id.
// This is the time zone for the local time to which you wish to convert.
CTzId* myZoneId = CTzId::NewL( KEuropeLondon );
CleanupStack::PushL( myZoneId );
// Create a client interface object to the time zone server
RTz myTZoneServer;
// Connect to the time zone server, leaves if fails to connect
User::LeaveIfError( myTZoneServer.Connect() );
CleanupClosePushL( myTZoneServer );
// Create a converter object.
CTzConverter* myConverter = CTzConverter::NewL( myTZoneServer );
CleanupStack::PushL( myConverter );
_LIT8( KMyTime,"20050328:185600.00" ); // UTC time to convert (28 March 2005 18:56 hrs).
TTime myTime( KMyTime ); // Create the time as a TTime object
// Convert UTC to local time in Europe/London time zone.
myConverter->ConvertToLocalTime( myTime, *myZoneId );
// myTime is updated to hold the local time value.
// Clean up
CleanupStack::PopAndDestroy(3);// causes myTZoneServer.Close() to be called
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.