Class: Date

Core.PDFNet. Date


new Date( [year] [, month] [, day] [, hour] [, minute] [, second] [, UT] [, UT_hour] [, UT_minutes] [, mp_obj])

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.
Parameters:
Name Type Argument Description
year number <optional>
month number <optional>
day number <optional>
hour number <optional>
minute number <optional>
second number <optional>
UT number <optional>
UT_hour number <optional>
UT_minutes number <optional>
mp_obj Core.PDFNet.Obj <optional>
Properties:
Name Type Description
year number
month number
day number
hour number
minute number
second number
UT number
UT_hour number
UT_minutes number
mp_obj Core.PDFNet.Obj

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: "PDFNet.Date"
Type
Promise.<Core.PDFNet.Date>

attach(d)

attach the Cos/SDF object to the Date.
Parameters:
Name Type Description
d Core.PDFNet.Obj underlying Cos/SDF object. Must be an SDF::Str containing a PDF date object.
Returns:
Type
Promise.<void>

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. Note: If this method returns false the underlying SDF/Cos object is null and the Date object should be treated as null as well.
Type
Promise.<boolean>

setCurrentTime()

Sets the date object to the current date and time. The method also updates associated SDF object.
Returns:
Type
Promise.<void>

update( [d])

Saves changes made to the Date object in the attached (or specified) SDF/Cos string.
Parameters:
Name Type Argument Description
d Core.PDFNet.Obj <optional>
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
Promise.<boolean>