Converting Between Date-Time Formats


Mac OS X header: CoreServices/CoreServices.h
Mac OS 9 header: DateTimeUtils.h


Converting Between Date-Time Formats Functions
DateToSeconds Converts a date and time to a number of seconds elapsed since midnight, January 1, 1904.
SecondsToDate Converts a number of seconds elapsed since midnight, January 1, 1904 to a date and time.


DateToSeconds

Carbon status: Supported

Converts a date and time to a number of seconds elapsed since midnight, January 1, 1904.

void DateToSeconds (
    const DateTimeRec *d, 
    UInt32 *secs
);
Parameter descriptions
d

The date-time structure containing the date and time to convert.

secs

On return, the number of seconds elapsed between midnight, January 1, 1904, and the time specified in the d parameter. For example, specifying a date and time of 5:50 A.M. on June 13, 1990 results in 41627 being returned in this parameter.

Discussion

The system software uses the DateToSeconds function provided by the current script system.

The DateToSeconds function is also available as the Date2Secs function.

For a complete description of the date-time record, see DateTimeRec.

Availability

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


SecondsToDate

Carbon status: Supported

Converts a number of seconds elapsed since midnight, January 1, 1904 to a date and time.

void SecondsToDate (
    UInt32 secs, 
    DateTimeRec *d
);
Parameter descriptions
secs

The number of seconds elapsed since midnight, January 1, 1904.

d

On return, the fields of the date-time structure that contain the date and time corresponding to the value indicated in the s parameter.

Discussion

The system software uses the SecondsToDate function provided by the current script system.

The SecondsToDate function is also available as the Secs2Date function.

For a complete description of the date-time record, see DateTimeRec.

Availability

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2001 Apple Computer, Inc. (Last Updated July 17, 2001)