org.icepdf.core.pobjects
Class PDate

java.lang.Object
  extended by org.icepdf.core.pobjects.PDate

public class PDate
extends java.lang.Object

This class defines a standard PDF date. The class will try its best to parse the date format into its component parts. If a date cannot be parsed, a non-standard flag is set to true. In this instance, any of the data accessor methods will return the unparsed string.

PDF defines a standard date format, which closely follows that of the international standard ASN.1 (Abstract Syntax Notation One), defined in ISO/IEC 8824. A date is a string of the form (D:YYYYMMDDHHmmSSOHH'mm') where:

The apostrophe character (') after HH and mm is part of the syntax. All fields after the year are optional. (The prefix D:, although also optional, is strongly recommended.) The default values for MM and DD are both 01; all other numerical fields default to zero values. A plus sign (+) as the value of the O field signifies that local time is later than UT, a minus sign (-) that local time is earlier than UT, and the letter Z that local time is equal to UT. If no UT information is specified, the relationship of the specified time to UT is considered to be unknown. Whether or not the time zone is known, the rest of the date should be specified in local time. For example, December 23, 1998, at 7:52 PM, U.S. Pacific Standard Time, is represented by the string D:199812231952?08'00'

Since:
1.1

Constructor Summary
PDate(SecurityManager securityManager, java.lang.String date)
          Create a new Date object.
 
Method Summary
 java.lang.String getDay()
          Gets the day value of the date.
 java.lang.String getHour()
          Gets the hour value of the date.
 java.lang.String getMinute()
          Gets the minute value of the date.
 java.lang.String getMonth()
          Gets the month value of the date.
 java.lang.String getSecond()
          Gets the second value of the date.
 java.lang.String getTimeZoneHour()
          Gets the time zone offset hour from GMT.
 java.lang.String getTimeZoneMinute()
          Gets the time zone offset minute from GMT.
 boolean getTimeZoneOffset()
          Gets the time zone offset fromm GMT.
 java.lang.String getYear()
          Gets the year value of the date.
 java.lang.String toString()
          Returns a decoded string representation of the date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PDate

public PDate(SecurityManager securityManager,
             java.lang.String date)
Create a new Date object.

Parameters:
date - date ASCII data.
Method Detail

getYear

public java.lang.String getYear()
Gets the year value of the date.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
year value.

getMonth

public java.lang.String getMonth()
Gets the month value of the date.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
month value.

getDay

public java.lang.String getDay()
Gets the day value of the date.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
day value.

getHour

public java.lang.String getHour()
Gets the hour value of the date.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
hour value.

getMinute

public java.lang.String getMinute()
Gets the minute value of the date.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
minute value.

getSecond

public java.lang.String getSecond()
Gets the second value of the date.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
second value.

getTimeZoneHour

public java.lang.String getTimeZoneHour()
Gets the time zone offset hour from GMT.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
hour value.

getTimeZoneMinute

public java.lang.String getTimeZoneMinute()
Gets the time zone offset minute from GMT.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
minute value.

getTimeZoneOffset

public boolean getTimeZoneOffset()
Gets the time zone offset fromm GMT. If the offset is negative true is returned, false otherwise.
Note
If the original date value cannot be parsed, this method returns the unparsed string.

Returns:
time offset value.

toString

public java.lang.String toString()
Returns a decoded string representation of the date object. If the date object could not be parsed, the orginal date value is returned.

Overrides:
toString in class java.lang.Object
Returns:
date value.