|
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 concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-B1DD21A3-674A-5193-95CF-F533FDBBD319" xml:lang="en"><title>Using |
|
13 Date and Time Handling</title><shortdesc>Explains how to manipulate Date and Time.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>Points in time are stored and manipulated using the <codeph>TTime</codeph> class. <codeph>TTime</codeph> uses |
|
15 a 64-bit integer to represent time as the number of microseconds since midnight |
|
16 on 1st January 0 AD, using a nominal Gregorian calendar. This gives a possible |
|
17 range of 580,000 years.</p> |
|
18 <p>The date/time and its individual components may be set and retrieved using |
|
19 the <codeph>TDateTime</codeph> class. <codeph>TDateTime</codeph> is the human |
|
20 readable form of <codeph>TTime</codeph>. It is provided to allow easy user |
|
21 access to the year, month, day, hour, minute, second and microsecond components |
|
22 of the time. It does not support manipulation of the date/time, or of its |
|
23 components, but may be converted into a <codeph>TTime</codeph>, and vice versa.</p> |
|
24 <p>Intervals between points in time are represented by the classes derived |
|
25 from <codeph>TTimeIntervalBase</codeph> and by class <codeph>TTimeIntervalMicroSeconds</codeph>. |
|
26 Time intervals can be added or subtracted, either to or from each other or |
|
27 to or from points in time. Time interval classes exist because adding two |
|
28 points in time or subtracting one point in time from another is not possible.</p> |
|
29 <p>The <codeph>Time</codeph> class is a collection of time related utility |
|
30 functions; for example, functions that check for leap years and return the |
|
31 number of days in the month.</p> |
|
32 <section id="GUID-EA8DB5D2-2979-44A9-9D12-AB454050B03E"><title>Arithmetic operations</title> <p>Care should be taken when |
|
33 performing arithmetic operations on <codeph>TTime</codeph> s especially when |
|
34 dealing with the last day in the month. For example: </p> <ul> |
|
35 <li id="GUID-81A3ED23-55B5-5BEF-A2C5-D05458512637"><p>adding one month to |
|
36 October 18th adds 31 days</p> </li> |
|
37 <li id="GUID-CBF68BC9-7F83-5FEC-B5BC-2E63906A5747"><p>adding one month to |
|
38 November 18th adds 30 days</p> </li> |
|
39 <li id="GUID-019F031D-5228-594E-8ECF-9DCAA7C04B09"><p>adding one year to February |
|
40 29th, 1996 gives Feb 28th, 1997</p> </li> |
|
41 <li id="GUID-D019C0F8-9B74-5405-82D4-1ECEB7C3329B"><p>adding one month to |
|
42 March 31st gives April 30th but subtracting one month from April 30th gives |
|
43 March 30th</p> </li> |
|
44 </ul> </section> |
|
45 </conbody></concept> |