Carbon


StringToTime

Header: DateTimeUtils.h Carbon status: Supported

Parses a string for a time specification and converts the date information into values in a date-time structure.

StringToDateStatus StringToTime (
    Ptr textPtr, 
    SInt32 textLen, 
    DateCachePtr theCache, 
    SInt32 *lengthUsed, 
    LongDateRec *dateTime
);
Parameter descriptions
textPtr

A pointer to the text string to be parsed. At the beginning of the string, StringToTime expects a time specification in a format defined by the current script.

textLen

The number of bytes in the text string.

theCache

A pointer to the date cache structure initialized by the InitDateCache function with data that is used during the conversion process.

lengthUsed

On output, contains a pointer to the length, in bytes, of the string that was parsed for the time.

dateTime

On output, a pointer to the LongDateRec structure, which contains the hour, minute, and second values that were parsed for the time.

function result

StringToTime returns a status value that indicates the confidence level for the success of the conversion. This is the same status value indicator type as does StringToDate: a set of bit values that indicate confidence levels, with higher numbers indicating low confidence in how closely the input string matched what the function expected.

DISCUSSION

StringToTime parses the string until it has finished finding all time information or until it has examined the number of bytes specified by textLen.

Note that StringToTime fills in only the hour, minute, and second; StringToDate fills in the year, month, day, and day of the week. You can use these two functions sequentially to fill in all of the values in a LongDateRec structure.

SPECIAL CONSIDERATIONS

StringToTime 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)