Date and time formatting

TFormattableTime, derived from TFormattable, and TDateTimeFormatter, derived from TFormatter, provide the basic mechanisms for scanning and formatting date and time data.

The system expresses the current date and time as a measurement of seconds relative to an arbitrary base time, or Coordinated Universal Time (UTC) time, encapsulated in an instance of TTime. See the chapter "Timing services" in the manual OS Services for more information on TTime and related classes.

The date and time formatting classes allow you to express UTC information in a more meaningful way, according to a particular time zone and a particular calendar system. Each formatter also provides one or more formatting patterns appropriate to the preferred usage and locale.


TFormattableTime wraps an instance of TTime, representing UTC time, so that it can be formatted by a TDateTimeFormatter.

TDateTimeFormatter is the abstract base class for classes that scan and format time and date information. TDateTimeFormatter manipulates time information wrapped in a TFormattableTime instance.

TPatternBasedDateTimeFormatter, an abstract subclass of TDateTimeFormatter, supports formatters that maintain a pattern for use in scanning and formatting. You can specify alternate patterns to extend the ability of the scanning function. The pattern is specified as an instance of TDateTimePattern.

TGregorianDateTimeFormatter is a concrete formatting class that formats and scans dates and times based on the Gregorian calendar used in many parts of the world.

The date and time formatting process requires two other classes:

TCalendar performs conversions between a TTime containing the local time and particular date and time fields (for example, month, date, and year). TGregorianCalendar is a concrete subclass of TCalendar that defines the calendar fields for the Gregorian calendar.

TTimeZone performs conversions between a TTime containing the UTC time and a TTime containing the local time for a particular locale.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker