Note: ASDate objects are not guaranteed to represent local time accurately. To be exact, in Mac OS and UNIX, ASDate cannot always determine the prevailing daylight saving rule for the operating system's time zone. See ASDateGetCurrentLocalTime() for further explanation.
typedef
struct
_t_ASDateRec
*
ASDate
;
For value options see ASTimeOptions.
typedef
ASEnum8
ASDateTimeFormat
;
A time/date structure.
The millisecond field is currently unused.
| |
Only common era years are displayed appropriately.
| |
Jan =
1 ,..., Dec = 12 . | |
1..31 | |
0..23 | |
0..59 | |
0..59 | |
0..999 | |
Sun =
0 ,... Sat = 6 . | |
GMT offset in half hours east of Greenwich.
-48 signifies an unknown value. | |
|
Note: There is some ambiguity in a calendar time span; to add an exact time span (for example, 2592000 seconds rather than one month), use ASDateAddTimeSpan().
void
ASDateAddCalendarTimeSpan(
ASDate
date
,
const
ASCalendarTimeSpan
timeSpan
);
date | The date.
|
timeSpan | The calendar time span to add.
|
void
ASDateAddTimeSpan(
ASDate
date
,
const
ASTimeSpan
timeSpan
);
date | The date.
|
timeSpan | The time span to add.
|
void
ASDateCalendarDiff(
const
ASDate
date1
,
const
ASDate
date2
,
ASCalendarTimeSpan
result
);
date1 | The first date.
|
date2 | The second date.
|
result | The calendar time span structure in which to store the difference.
|
void
ASDateClear(
ASDate
retVal
);
retVal | The date object.
|
ASInt32
ASDateCompare(
const
ASDate
date1
,
const
ASDate
date2
);
date1 | The first date.
|
date2 | The second date.
|
1
if date1
>
date2
, 0
if they are equal,-1
if date1
<
date2
. void
ASDateCopy(
const
ASDate
original
,
ASDate
copy
);
original | The date to be copied.
|
copy | The date into which the data is copied.
|
void
ASDateDestroy(
ASDate
date
);
date | The date.
|
ASDate
ASDateDup(
const
ASDate
date
);
date | The date to duplicate.
|
date1
is earlier than date2
, the result is negative. void
ASDateExactDiff(
const
ASDate
date1
,
const
ASDate
date2
,
ASTimeSpan
result
);
date1 | The first date.
|
date2 | The second date.
|
result | The time span structure in which to store the difference.
|
ASTimeRec
ASDateGetLocalTime(
const
ASDate
date
);
date | The date.
|
Creates a time string from a date object according to a specified format. If time zone information is available in the date object, the string contains the local time along with the time zone adjustment, if that is supported by the requested format. It raises an exception if there is not enough memory.
It is the client's responsibility to release the memory associated with the returned string using ASfree().
char
*
ASDateGetTimeString(
const
ASDate
date
,
ASDateTimeFormat
format
);
date | The date object.
|
format | The format of the time string.
|
ASTimeRec
ASDateGetUTCTime(
const
ASDate
date
);
date | The date object.
|
Creates a date object. The newly allocated object reflects the epoch time: Jan 1 1970 00:00:00 UTC.
Raises an exception if there is not enough memory for the operation.
ASDate
ASDateNew(
void
);
void
ASDateSetLocalTimeOffset(
ASDate
date
);
date | The date.
|
1
-based. void
ASDateSetTimeFromRec(
ASDate
date
,
const
ASTimeRec
*
timeRec
);
date | The date object.
|
timeRec | The time record.
|
void
ASDateSetTimeFromString(
ASDate
date
,
const
char
*
timeString
,
ASDateTimeFormat
format
);
date | The date object.
|
timeString | The time string, in the specified format.
|
format | The format of the time string. kASTimeNone and kASTimeUniversalH are not supported.
|
void
ASDateSetToCurrentLocalTime(
ASDate
date
);
date | The date.
|
void
ASDateSetToCurrentUTCTime(
ASDate
retVal
);
retVal | The date.
|
Note: There is some ambiguity in a calendar time span; to subtract an exact time span (for example, 2592000 seconds rather than one month), use ASDateSubtractTimeSpan().
void
ASDateSubtractCalendarTimeSpan(
ASDate
date
,
const
ASCalendarTimeSpan
timeSpan
);
date | The date.
|
timeSpan | The calendar time span to subtract.
|
void
ASDateSubtractTimeSpan(
ASDate
date
,
const
ASTimeSpan
timeSpan
);
date | The date.
|
timeSpan | The time span to subtract.
|