public class

Date

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.Date

Class Overview

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.

Summary

Public Constructors
Date()
Date default constructor.
Date(Obj d)
Create a Date and initialize it using given Cos/SDF string date object.
Date(short year, byte month, byte day, byte hour, byte minute, byte second)
Create a Date and initialize it using specified parameters.
Public Methods
static Date __Create(long impl)
long __GetHandle()
void attach(Obj d)
Attach the Cos/SDF object to the Date.
boolean equals(Object other)
byte getDay()
Get the day.
byte getHour()
Get the hour.
byte getMinute()
Get the minute.
byte getMonth()
Get the month.
byte getSecond()
Get the second.
byte getUT()
Get the relationship of local time to Universal Time(UT), denoted by one of the characters +, -, or Z
byte getUTHour()
Get the absolute value of the offset from UT in hours(00-23)
byte getUTMinutes()
Get the absolute value of the offset from UT in minutes(00-59)
short getYear()
Get the year.
int hashCode()
boolean isValid()
Indicates whether the Date is valid(non-null).
void seUTMinutes(byte ut_minutes)
void setCurrentTime()
Set the current time.
void setDay(byte day)
Set the day.
void setHour(byte hour)
Set the hour.
void setMinute(byte minute)
Set the minute.
void setMonth(byte month)
Set the month.
void setSecond(byte second)
Set the second.
void setUT(byte ut)
Set the relationship of local time to Universal Time(UT),
void setUTHour(byte ut_hour)
Set the absolute value of the offset from UT in hours(00-23)
void setUTMinutes(byte ut_minutes)
Set the absolute value of the offset from UT in minutes(00-59)
void setYear(short year)
Set the year.
boolean update(Obj d)
Saves changes made to the Date object in the attached(or specified) SDF/Cos string.
boolean update()
Saves changes made to the Date object in the attached(or specified) SDF/Cos string.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Date ()

Date default constructor.

public Date (Obj d)

Create a Date and initialize it using given Cos/SDF string date object. String date object is attached to this Date.

Parameters
d input string date object

public Date (short year, byte month, byte day, byte hour, byte minute, byte second)

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

Public Methods

public static Date __Create (long impl)

public long __GetHandle ()

public void attach (Obj d)

Attach the Cos/SDF object to the Date.

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

public boolean equals (Object other)

public byte getDay ()

Get the day.

Returns
  • the day(01-31).

public byte getHour ()

Get the hour.

Returns
  • the hour(00-23).

public byte getMinute ()

Get the minute.

Returns
  • the minute(00-59).

public byte getMonth ()

Get the month.

Returns
  • the month

public byte getSecond ()

Get the second.

Returns
  • the second(00-59).

public byte getUT ()

Get the relationship of local time to Universal Time(UT), denoted by one of the characters +, -, or Z

Returns
  • The relationship of local time to Universal Time(UT), denoted by one of the characters +, -, or Z

public byte getUTHour ()

Get the absolute value of the offset from UT in hours(00-23)

Returns
  • the absolute value of the offset from UT in hours(00-23)

public byte getUTMinutes ()

Get the absolute value of the offset from UT in minutes(00-59)

Returns
  • the absolute value of the offset from UT in minutes(00-59)

public short getYear ()

Get the year.

Returns
  • the year

public int hashCode ()

public boolean isValid ()

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

Note: If this method returns false the underlying SDF/Cos object is null and the Date object should be treated as null as well.

Returns
  • True if this is a valid(non-null) Date; otherwise false.

public void seUTMinutes (byte ut_minutes)

public void setCurrentTime ()

Set the current time.

public void setDay (byte day)

Set the day.

Parameters
day the new day

public void setHour (byte hour)

Set the hour.

Parameters
hour the new hour

public void setMinute (byte minute)

Set the minute.

Parameters
minute the new minute

public void setMonth (byte month)

Set the month.

Parameters
month the new month

public void setSecond (byte second)

Set the second.

Parameters
second the new second

public void setUT (byte ut)

Set the relationship of local time to Universal Time(UT),

Parameters
ut the relationship of local time to Universal Time(UT),

public void setUTHour (byte ut_hour)

Set the absolute value of the offset from UT in hours(00-23)

Parameters
ut_hour the absolute value of the offset from UT in hours(00-23)

public void setUTMinutes (byte ut_minutes)

Set the absolute value of the offset from UT in minutes(00-59)

Parameters
ut_minutes the absolute value of the offset from UT in minutes(00-59)

public void setYear (short year)

Set the year.

Parameters
year the new year

public boolean update (Obj d)

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

Parameters
d - 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
  • true, if successful

public boolean update ()

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

Returns
  • true if the attached Cos/SDF string was successfully updated, false otherwise.