Class 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.
Implements
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFTronDotNet.dll
Syntax
public class Date : IDisposable
Constructors
Date()
Date default constructor.
Declaration
public Date()
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
Date(short, byte, byte, byte, byte, byte)
Create a Date and initialize it using specified parameters. The Date is not attached to any Cos/SDF object.
Declaration
public Date(short year, byte month, byte day, byte hour, byte minute, byte second)
Parameters
| Type | Name | Description |
|---|---|---|
| short | year | the year |
| byte | month | the month |
| byte | day | the day |
| byte | hour | the hour |
| byte | minute | the minute |
| byte | second | the second |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
Date(Date)
Creates a Date object from specified Date object
Declaration
public Date(Date d)
Parameters
| Type | Name | Description |
|---|---|---|
| Date | d |
|
Date(Obj)
Create a Date and initialize it using given Cos/SDF string date object. String date object is attached to this Date.
Declaration
public Date(Obj d)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | d | the |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
Properties
UT
The relationship of local time to Universal Time (UT), denoted by one of the characters +, -, or Z. Use cast to set the property, for example: (byte)'-'
Declaration
public byte UT { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
UT_hour
The absolute value of the offset from UT in hours (0-23)
Declaration
public byte UT_hour { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
UT_minutes
The absolute value of the offset from UT in minutes (0-59)
Declaration
public byte UT_minutes { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
day
The day (1-31).
Declaration
public byte day { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
hour
The hour (0-23).
Declaration
public byte hour { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
minute
The minute (0-59).
Declaration
public byte minute { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
month
The month.
Declaration
public byte month { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
second
The second (0-59).
Declaration
public byte second { get; set; }
Property Value
| Type | Description |
|---|---|
| byte |
year
The year.
Declaration
public short year { get; set; }
Property Value
| Type | Description |
|---|---|
| short |
Methods
Attach(Obj)
Attach the Cos/SDF object to the Date.
Declaration
public void Attach(Obj d)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | d |
|
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
~Date()
Releases all resources used by the Date
Declaration
protected ~Date()
IsValid()
Indicates whether the Date is valid (non-null).
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| bool | True if this is a valid (non-null) Date; otherwise false. |
Remarks
If this method returns false the underlying SDF/Cos object is null and the Date object should be treated as null as well.
Set(Date)
Sets value to given Date object
Declaration
public void Set(Date p)
Parameters
| Type | Name | Description |
|---|---|---|
| Date | p | given |
SetCurrentTime()
Sets the current time.
Declaration
public void SetCurrentTime()
Update()
Saves changes made to the Date object in the attached (or specified) SDF/Cos string.
Declaration
public bool Update()
Returns
| Type | Description |
|---|---|
| bool | true if the attached Cos/SDF string was successfully updated, false otherwise. |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
Update(Obj)
Update.
Declaration
public bool Update(Obj d)
Parameters
| Type | Name | Description |
|---|---|---|
| Obj | d | the d |
Returns
| Type | Description |
|---|---|
| bool | true, if successful |
Exceptions
| Type | Condition |
|---|---|
| PDFNetException | PDFNetException the PDFNet exception |
op_Assign(Date)
Assignment operator
Declaration
public Date op_Assign(Date r)
Parameters
| Type | Name | Description |
|---|---|---|
| Date | r | object at the right of the operator |
Returns
| Type | Description |
|---|---|
| Date | object equals to the given object |