Class: Date

PDFNet. Date


new Date()

The Date class is a utility class used to simplify work with PDF date objects.

PDF defines a standard date format, which closely follows international standard ASN.1 (Abstract Syntax Notation One), A date is a string of the form (D:YYYYMMDDHHmmSSOHH'mm'); See PDF Reference Manual for details.

Date can be associated with a SDF/Cos date string using Date(Obj*) constructor or later using Date::Attach(Obj*) or Date::Update(Obj*) methods.

Date keeps a local date/time cache so it is necessary to call Date::Update() method if the changes to the Date should be saved in the attached Cos/SDF string.

Methods


<static> init(year, month, day, hour, minute, second)

Create a Date and initialize it using specified parameters. The Date is not attached to any Cos/SDF object.

Parameters:
Name Type Description
year number

number representing the year to initialize the Date object to.

month number

number representing the month to initialize the Date object to.

day number

number representing the day to initialize the Date object to.

hour number

number representing the hour to initialize the Date object to.

minute number

number representing the minute to initialize the Date object to.

second number

number representing the second to initialize the Date object to.

Returns:

A promise that resolves to an object of type: "date"

Type
PDFNet.Date

assign(right)

Parameters:
Name Type Description
right PDFNet.date

attach(d)

attach the Cos/SDF object to the Date.

Parameters:
Name Type Description
d PDFNet.Obj

underlying Cos/SDF object. Must be an SDF::Str containing a PDF date object.


isValid()

Indicates whether the Date is valid (non-null).

Returns:

A promise that resolves to true if this is a valid (non-null) Date; otherwise false.

Type
boolean

update(d)

Saves changes made to the Date object in the attached (or specified) SDF/Cos string.

Parameters:
Name Type Description
d PDFNet.Obj

an optional parameter indicating a SDF string that should be updated and attached to this Date. If parameter d is NULL or is omitted, update is performed on previously attached Cos/SDF date.

Returns:

A promise that resolves to true if the attached Cos/SDF string was successfully updated, false otherwise.

Type
boolean