Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Using Date and Time Handling

Points in time are stored and manipulated using the TTime class. TTime 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.

The date/time and its individual components may be set and retrieved using the TDateTime class. TDateTime is the human readable form of TTime. 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 TTime, and vice versa.

Intervals between points in time are represented by the classes derived from TTimeIntervalBase and by class TTimeIntervalMicroSeconds. 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.

The Time 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.


Arithmetic operations

Care should be taken when performing arithmetic operations on TTimes especially when dealing with the last day in the month. For example: