Carbon


DateString

Header: DateTimeUtils.h Carbon status: Supported

Converts a date in the standard date-time representation into a Pascal string, making use of the date formatting information in the specified resource.

void DateString (
    SInt32 dateTime, 
    DateForm longFlag, 
    Str255 result, 
    Handle intlHandle
);
Parameter descriptions
dateTime

The date-time value in the representation returned by the GetDateTime function. The numeric representation used in these functions is the standard date-time representation: a 32-bit integer value that is returned by the GetDateTime function. This is a long integer value that represents the number of seconds between midnight, January 1, 1904, and the time at which GetDateTime was called.

longFlag

A flag that indicates the desired format for the date string. This is one of the three values defined as the DateForm type.

The string produced by DateString is in one of three standard date formats used on the Macintosh, depending on which of the three DateForm values that you specify for the longFlag parameter: shortDate, abbrevDate, or longDate. The information in the supplied resource defines how month and day names are written and provides for calendars with more than 7 days and more than 12 months.

For the Roman script system’s resource, the date January 31, 1991, produces the following three strings: “1/31/92“, “Fri, Jan 31, 1992“, and “Fri, Jan 31, 1992“ (for DateForm values shortDate, abbrevDate, and longDate, respectively).

result

On output, contains the string representation of the date in the format indicated by the longFlag parameter.

intlHandle

A handle to a numeric-format or a long-date-format resource that specifies date formatting information for use in the conversion. If you specify NULL as the value of the resource handle parameter, DateString uses information from the current script. The numeric-format ('itl0') resource specifies the short date formats and the long-date-format ('itl1') resource specifies the long date formats.

DateString formats its data according to the information in the specified numeric-format resource (for short date formats) or long-date-format resource (for long date formats). If you specify shortDate, the intlHandle value should be the handle to a numeric-format resource; if you specify abbrevDate or longDate, it should be the handle to a long-date-format resource.

SPECIAL CONSIDERATIONS

DateString may move memory; your application should not call this function at interrupt time.

AVAILABILITY

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


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)