LayerAS_Layer
ObjectASDate

Date objects represent a particular date and time. All date objects are guaranteed to give accurate representation of UTC time (not adjusted for leap seconds, as the addition of leap seconds to the international calendar does not happen according to a well-defined rule).

The related ASTimeSpan object represents an exact time span, measured in seconds.

Methods allow you to set, clear, compare, add, and subtract dates and times in various formats.



Typedef Summary
 Typedef
 ASDate
An opaque object holding information for a particular date and time. All ASDate objects are guaranteed to give accurate representation of UTC time, unadjusted for leap seconds. This is due to the fact that the introduction of leap seconds to the international calendar does not happen according to a well-defined rule.
Enumeration Summary
 Enumeration
  ASDateTimeFormat
A constant indicating a string format for representing a date and time.
Method Summary
 Method
 
Adds a calendar time span to a date. It modifies the date by the length of time provided in the ASCalendarTimeSpan object.
 
void ASDateAddTimeSpan(ASDate date, const ASTimeSpan timeSpan)
Adds a time span (an exact number of seconds) to a date. It modifies the date by the length of time provided in the ASTimeSpan object.
 
void ASDateCalendarDiff(const ASDate date1, const ASDate date2, ASCalendarTimeSpan result)
Calculates the difference between two ASDate objects and stores the result in the provided ASCalendarTimeSpan object. The result is broken down into years, months, and so on, in the highest denomination possible. For example, a difference of 13 months is reported as 1 year and 1 month.
 
void ASDateClear(ASDate retVal)
Reinitializes a date object to the newly-allocated state, as returned by ASDateNew().
 
ASInt32 ASDateCompare(const ASDate date1, const ASDate date2)
Tests whether one date is earlier or later than another.
 
void ASDateCopy(const ASDate original, ASDate copy)
Copies date and time data from one date object to another.
 
Releases and destroys a date object.
 
ASDate ASDateDup(const ASDate date)
Creates a new date object containing the same data as an existing date object.
 
void ASDateExactDiff(const ASDate date1, const ASDate date2, ASTimeSpan result)
Calculates the exact difference in seconds between two date objects and stores the result in the provided ASTimeSpan object. If date1 is earlier than date2, the result is negative.
 
ASTimeRec ASDateGetLocalTime(const ASDate date)
Creates a time record that represents the local time represented by the date object. The resulting local time might not account for daylight savings time correctly if the date object has been modified by adding or substracting a time span or calendar time span. It raises an exception if there is not enough memory.
 
char* ASDateGetTimeString(const ASDate date, ASDateTimeFormat format)
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.
 
ASTimeRec ASDateGetUTCTime(const ASDate date)
Creates a time record that represents the UTC time represented by the date object. It raises an exception if there is not enough memory.
 
ASDate ASDateNew()
Creates a date object. The newly allocated object reflects the epoch time: Jan 1 1970 00:00:00 UTC.
 
Sets a date object's local time offset according to the operating system's current time zone information. Different operating systems handle daylight savings differently. This method causes the date object to always use the same daylight savings time offset that the operating system is currently using, even if the date object is modified.
 
void ASDateSetTimeFromRec(ASDate date, const ASTimeRec* timeRec)
Initializes a date object from a time record. It raises an exception if the time structure represents an invalid time, such as January 32nd 1999 or Feb 29th 2001. It assumes that the parameters for the day and month in the time record are 1-based.
 
void ASDateSetTimeFromString(ASDate date, const char* timeString, ASDateTimeFormat format)
Initializes a date object from a time string. It raises an exception if there is not enough memory, if the format is unrecognized, or if the time string is not formatted according to the supplied format.
 
Sets a date object to the current local time, using the time zone information from the operating system.
 
Sets a date object to the current UTC time with no time zone information.
 
Subtracts a calendar time span from a date. It modifies the date by the length of time provided in the ASCalendarTimeSpan object.
 
void ASDateSubtractTimeSpan(ASDate date, const ASTimeSpan timeSpan)
Subtracts a time span (an exact number of seconds) from a date. It modifies the date by the length of time provided in the ASTimeSpan object.

Typedefs Detail
ASDate 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

typedef struct _t_ASDateRec* ASDate;

An opaque object holding information for a particular date and time. All ASDate objects are guaranteed to give accurate representation of UTC time, unadjusted for leap seconds. This is due to the fact that the introduction of leap seconds to the international calendar does not happen according to a well-defined rule.

See Also

ASDateGetCurrentLocalTime

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.

File: ASExpT.h
Line: 4043

Enumeration Detail
ASDateTimeFormat
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

enum ASDateTimeFormat {
 kASTimeNone = 0,
 
 kASTimePDF,
 
 kASTimeUniversal,
 
 kASTimeUniversalH,
 
 kASTimeUTC_ASN1,
 
 kASTimeGENERALIZED_ASN1
}

File: ASExpT.h
Line: 4016

Elements
kASTimeNone  

None.

 
kASTimePDF  

PDF date format, as defined in the PDF Reference.

 
kASTimeUniversal  

Slight variations of the time format expressed in ISO 8601.

 
kASTimeUniversalH  

Slight variations of the time format expressed in ISO 8601.

 
kASTimeUTC_ASN1  

UTC ASN1 format.

 
kASTimeGENERALIZED_ASN1  

ASN1 format.



Method Detail
ASDateAddCalendarTimeSpan()
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateAddCalendarTimeSpan(ASDate date, const ASCalendarTimeSpan timeSpan)

Adds a calendar time span to a date. It modifies the date by the length of time provided in the ASCalendarTimeSpan object.

Parameters

date — 

The date.

 
timeSpan — 

The calendar time span to add.

See Also

Since

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().

File: ASExtraProcs.h
Line: 1870
ASDateAddTimeSpan() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateAddTimeSpan(ASDate date, const ASTimeSpan timeSpan)

Adds a time span (an exact number of seconds) to a date. It modifies the date by the length of time provided in the ASTimeSpan object.

Parameters

date — 

The date.

 
timeSpan — 

The time span to add.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1895
ASDateCalendarDiff() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateCalendarDiff(const ASDate date1, const ASDate date2, ASCalendarTimeSpan result)

Calculates the difference between two ASDate objects and stores the result in the provided ASCalendarTimeSpan object. The result is broken down into years, months, and so on, in the highest denomination possible. For example, a difference of 13 months is reported as 1 year and 1 month.

Parameters

date1 — 

The first date.

 
date2 — 

The second date.

 
result — 

The calendar time span structure in which to store the difference.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1912
ASDateClear() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateClear(ASDate retVal)

Reinitializes a date object to the newly-allocated state, as returned by ASDateNew().

Parameters

retVal — 

The date object.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1700
ASDateCompare() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASInt32 ASDateCompare(const ASDate date1, const ASDate date2)

Tests whether one date is earlier or later than another.

Parameters

date1 — 

The first date.

 
date2 — 

The second date.

Returns

1 if date1 > date2, 0 if they are equal, -1 if date1 < date2.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 2095
ASDateCopy() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateCopy(const ASDate original, ASDate copy)

Copies date and time data from one date object to another.

Parameters

original — 

The date to be copied.

 
copy — 

The date into which the data is copied.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1711
ASDateDestroy() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateDestroy(ASDate date)

Releases and destroys a date object.

Parameters

date — 

The date.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1721
ASDateDup() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASDate ASDateDup(const ASDate date)

Creates a new date object containing the same data as an existing date object.

Parameters

date — 

The date to duplicate.

Returns

The new date object.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1690
ASDateExactDiff() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateExactDiff(const ASDate date1, const ASDate date2, ASTimeSpan result)

Calculates the exact difference in seconds between two date objects and stores the result in the provided ASTimeSpan object. If date1 is earlier than date2, the result is negative.

Parameters

date1 — 

The first date.

 
date2 — 

The second date.

 
result — 

The time span structure in which to store the difference.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1928
ASDateGetLocalTime() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASTimeRec ASDateGetLocalTime(const ASDate date)

Creates a time record that represents the local time represented by the date object. The resulting local time might not account for daylight savings time correctly if the date object has been modified by adding or substracting a time span or calendar time span. It raises an exception if there is not enough memory.

Parameters

date — 

The date.

Returns

The newly created time record.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1976
ASDateGetTimeString() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

char* ASDateGetTimeString(const ASDate date, ASDateTimeFormat format)

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().

Parameters

date — 

The date object.

 
format — 

The format of the time string.

Returns

The time string in the specified format.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1947
ASDateGetUTCTime() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASTimeRec ASDateGetUTCTime(const ASDate date)

Creates a time record that represents the UTC time represented by the date object. It raises an exception if there is not enough memory.

Parameters

date — 

The date object.

Returns

The newly created time record.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1961
ASDateNew() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

ASDate ASDateNew()

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.

Returns

The newly created date object.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1679
ASDateSetLocalTimeOffset() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSetLocalTimeOffset(ASDate date)

Sets a date object's local time offset according to the operating system's current time zone information. Different operating systems handle daylight savings differently. This method causes the date object to always use the same daylight savings time offset that the operating system is currently using, even if the date object is modified.

Parameters

date — 

The date.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1801
ASDateSetTimeFromRec() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSetTimeFromRec(ASDate date, const ASTimeRec* timeRec)

Initializes a date object from a time record. It raises an exception if the time structure represents an invalid time, such as January 32nd 1999 or Feb 29th 2001. It assumes that the parameters for the day and month in the time record are 1-based.

Parameters

date — 

The date object.

 
timeRec — 

The time record.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1834
ASDateSetTimeFromString() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSetTimeFromString(ASDate date, const char* timeString, ASDateTimeFormat format)

Initializes a date object from a time string. It raises an exception if there is not enough memory, if the format is unrecognized, or if the time string is not formatted according to the supplied format.

Parameters

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.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1818
ASDateSetToCurrentLocalTime() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSetToCurrentLocalTime(ASDate date)

Sets a date object to the current local time, using the time zone information from the operating system.

Parameters

date — 

The date.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1787
ASDateSetToCurrentUTCTime() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSetToCurrentUTCTime(ASDate retVal)

Sets a date object to the current UTC time with no time zone information.

Parameters

retVal — 

The date.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1775
ASDateSubtractCalendarTimeSpan() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSubtractCalendarTimeSpan(ASDate date, const ASCalendarTimeSpan timeSpan)

Subtracts a calendar time span from a date. It modifies the date by the length of time provided in the ASCalendarTimeSpan object.

Parameters

date — 

The date.

 
timeSpan — 

The calendar time span to subtract.

See Also

Since

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().

File: ASExtraProcs.h
Line: 1855
ASDateSubtractTimeSpan() 
Product availability: PDFL
Platform availability: Macintosh, Windows, UNIX

Syntax

void ASDateSubtractTimeSpan(ASDate date, const ASTimeSpan timeSpan)

Subtracts a time span (an exact number of seconds) from a date. It modifies the date by the length of time provided in the ASTimeSpan object.

Parameters

date — 

The date.

 
timeSpan — 

The time span to subtract.

See Also

Since

PI_ACROSUPPORT_VERSION >= 0x00060000

File: ASExtraProcs.h
Line: 1882