Symbian3/SDK/Source/GUID-237E0861-EC1B-41DA-BDB0-1DEB50620CC8.dita
changeset 13 48780e181b38
equal deleted inserted replaced
12:80ef3a206772 13:48780e181b38
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-237E0861-EC1B-41DA-BDB0-1DEB50620CC8" xml:lang="en"><title>Converting
       
    13 from UTC to local time in a non-system time zone</title><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    14 <steps-unordered>
       
    15 <step id="GUID-ABF16F17-59D3-4655-909E-B637E1D80971"><cmd>The following code fragment converts a randomly chosen UTC time
       
    16 to local time for London:</cmd>
       
    17 <stepxmp><p><codeblock xml:space="preserve">_LIT8( KEuropeLondon,"Europe/London" );
       
    18 // Create a pointer to the time zone id.
       
    19 // This is the time zone for the local time to which you wish to convert.
       
    20 CTzId* myZoneId = CTzId::NewL( KEuropeLondon );
       
    21 CleanupStack::PushL( myZoneId );</codeblock><codeblock xml:space="preserve">// Create a client interface object to the time zone server
       
    22 RTz myTZoneServer; 
       
    23 // Connect to the time zone server, leaves if fails to connect
       
    24 User::LeaveIfError( myTZoneServer.Connect() ); 
       
    25 CleanupClosePushL( myTZoneServer );</codeblock><codeblock xml:space="preserve">// Create a converter object.
       
    26 CTzConverter* myConverter = CTzConverter::NewL( myTZoneServer ); 
       
    27 CleanupStack::PushL( myConverter );</codeblock><codeblock xml:space="preserve">_LIT8( KMyTime,"20050328:185600.00" ); // UTC time to convert (28 March 2005 18:56 hrs).
       
    28 TTime myTime( KMyTime ); // Create the time as a TTime object</codeblock><codeblock xml:space="preserve">// Convert UTC to local time in Europe/London time zone.
       
    29 myConverter-&gt;ConvertToLocalTime( myTime, *myZoneId ); 
       
    30 // myTime is updated to hold the local time value.</codeblock><codeblock xml:space="preserve">// Clean up
       
    31 CleanupStack::PopAndDestroy(3);// causes myTZoneServer.Close() to be called</codeblock></p></stepxmp>
       
    32 </step>
       
    33 </steps-unordered>
       
    34 </taskbody></task>