Symbian3/SDK/Source/GUID-B1DD21A3-674A-5193-95CF-F533FDBBD319.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-B1DD21A3-674A-5193-95CF-F533FDBBD319" xml:lang="en"><title>Using
Date and Time Handling</title><shortdesc>Explains how to manipulate Date and Time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Points in time are stored and manipulated using the <codeph>TTime</codeph> class. <codeph>TTime</codeph> uses
a 64-bit integer to represent time as the number of microseconds since midnight
on 1st January 0 AD, using a nominal Gregorian calendar. This gives a possible
range of 580,000 years.</p>
<p>The date/time and its individual components may be set and retrieved using
the <codeph>TDateTime</codeph> class. <codeph>TDateTime</codeph> is the human
readable form of <codeph>TTime</codeph>. It is provided to allow easy user
access to the year, month, day, hour, minute, second and microsecond components
of the time. It does not support manipulation of the date/time, or of its
components, but may be converted into a <codeph>TTime</codeph>, and vice versa.</p>
<p>Intervals between points in time are represented by the classes derived
from <codeph>TTimeIntervalBase</codeph> and by class <codeph>TTimeIntervalMicroSeconds</codeph>.
Time intervals can be added or subtracted, either to or from each other or
to or from points in time. Time interval classes exist because adding two
points in time or subtracting one point in time from another is not possible.</p>
<p>The <codeph>Time</codeph> class is a collection of time related utility
functions; for example, functions that check for leap years and return the
number of days in the month.</p>
<section id="GUID-EA8DB5D2-2979-44A9-9D12-AB454050B03E"><title>Arithmetic operations</title> <p>Care should be taken when
performing arithmetic operations on <codeph>TTime</codeph> s especially when
dealing with the last day in the month. For example: </p> <ul>
<li id="GUID-81A3ED23-55B5-5BEF-A2C5-D05458512637"><p>adding one month to
October 18th adds 31 days</p> </li>
<li id="GUID-CBF68BC9-7F83-5FEC-B5BC-2E63906A5747"><p>adding one month to
November 18th adds 30 days</p> </li>
<li id="GUID-019F031D-5228-594E-8ECF-9DCAA7C04B09"><p>adding one year to February
29th, 1996 gives Feb 28th, 1997</p> </li>
<li id="GUID-D019C0F8-9B74-5405-82D4-1ECEB7C3329B"><p>adding one month to
March 31st gives April 30th but subtracting one month from April 30th gives
March 30th</p> </li>
</ul> </section>
</conbody></concept>