Date and Time Utilities
Date and Time Utilities
The Script Manager contains four categories of routines that help with
worldwide date and time conversion. The routines convert among various
formats for dates and times, change long dates, modify and verify date and time
records, and read and store geographic locations. For details on related time and
date data structures, see Macintosh Worldwide Development: Guide to System
Software.
Converting Worldwide Dates and Times
The InitDateCache, String2Date, and String2Time functions let you
convert worldwide dates and times.
InitDateCache Formats the date cache record ( defined by the
DateCacheRecord data type) for use by the
String2Date and String2Time routines
String2Date Expects the date at beginning of text and parses text for
use in the date-time record ( defined by the
LongDateRec data type)
String2Time Expects the time at beginning of text and parses text for
use in the date-time record
Converting Long Dates
The LongDate2Secs and LongSecs2Date procedures allow you to convert
dates between the LongDateRec format (an explicit year, month, day, and so
forth) and the LongDateTime format (an 8-byte signed value, seconds since
January 1, 1904).
LongDate2Secs Converts the time specified in a long date record to a
LongDateTime format
LongSecs2Date Converts the date specified in a LongDateTime format to
a long date record
Modifying and Verifying Date and Time Records
The ToggleDate and ValidDate functions allow you to change date and time
records and check the validity of the resulting data structures.
ToggleDate Modifies a LongDateTime parameter by toggling one of
the corresponding fields of the long date record up or
down or by setting it explicitly.
ValidDate Checks the validity of a long date record
Reading and Storing Locations
The ReadLocation and WriteLocation procedures let you access,
manipulate, and store the geographic location of the Macintosh and related time
zone information.
ReadLocation Accesses the stored geographic location of the Macintosh
and the time zone information from the parameter RAM
WriteLocation Stores the geographic location of the Macintosh and the
time zone information in parameter RAM