Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 5 - Text Utilities / Text Utilities Reference
Routines / Converting Long Date and Time Values Into Strings


LongDateString

The LongDateString procedure converts a date that is specified as a LongDateTime value into a Pascal string, making use of the date formatting information in the specified resource.

PROCEDURE LongDateString(VAR dateTime: LongDateTime;
                         longFlag: DateForm;
                         VAR result: Str255; intlParam: Handle);
dateTime
A 64-bit, signed representation of the number of seconds since Jan. 1, 1904.
longFlag
A flag that indicates the desired format for the date string. This is one of the three values defined as the DateForm type.
result
On output, contains the string representation of the date in the format indicated by the longFlag parameter.
intlParam
A handle to a numeric-format or long-date-format resource that specifies date formatting information for use in the conversion. The numeric-format ('itl0') resource specifies the short date formats and the long-date-format ('itl1') resource specifies the long date formats.
DESCRIPTION
LongDateString converts the LongDateTime value in the dateTime parameter into a Pascal string representation of the date. You can use the LongSecondsToDate and LongDateToSeconds procedures, which are described in the book Inside Macintosh: Operating System Utilities, to convert between the LongDateRec (as produced by the StringToDate function) and LongDateTime data types.

The string produced by LongDateString 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 U.S. resource, the date January 31, 1991, produces the following three strings:
DateForm valueDate string produced
shortDate1/31/92
abbrevDateFri, Jan 31, 1992
longDateFriday, January 31, 1992

LongDateString 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 intlParam 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. If the intlParam value is NIL, LongDateString uses the resource from the current script.

SPECIAL CONSIDERATIONS
LongDateString may move memory; your application should not call this procedure at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the LongDateString procedure are
Trap macroSelector
_Pack6$0014


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996