com.lowagie.text.pdf

Class PdfDate

public class PdfDate extends PdfString

PdfDate is the PDF date object.

PDF defines a standard date format. The PDF date format closely follows the format defined by the international standard ASN.1 (Abstract Syntax Notation One, defined in CCITT X.208 or ISO/IEC 8824). A date is a PdfString of the form:

(D:YYYYMMDDHHmmSSOHH'mm')

This object is described in the 'Portable Document Format Reference Manual version 1.3' section 7.2 (page 183-184)

See Also: PdfString java.util.GregorianCalendar

Field Summary
static int[]DATE_SPACE
Constructor Summary
PdfDate(Calendar d)
Constructs a PdfDate-object.
PdfDate()
Constructs a PdfDate-object, representing the current day and time.
Method Summary
static Calendardecode(String s)
Converts a PDF string representing a date into a Calendar.
StringgetW3CDate()
Gives the W3C format of the PdfDate.
static StringgetW3CDate(String d)
Gives the W3C format of the PdfDate.
StringsetLength(int i, int length)
Adds a number of leading zeros to a given String in order to get a String of a certain length.

Field Detail

DATE_SPACE

private static final int[] DATE_SPACE

Constructor Detail

PdfDate

public PdfDate(Calendar d)
Constructs a PdfDate-object.

Parameters: d the date that has to be turned into a PdfDate-object

PdfDate

public PdfDate()
Constructs a PdfDate-object, representing the current day and time.

Method Detail

decode

public static Calendar decode(String s)
Converts a PDF string representing a date into a Calendar.

Parameters: s the PDF string representing a date

Returns: a Calendar representing the date or null if the string was not a date

getW3CDate

public String getW3CDate()
Gives the W3C format of the PdfDate.

Returns: a formatted date

getW3CDate

public static String getW3CDate(String d)
Gives the W3C format of the PdfDate.

Parameters: d the date in the format D:YYYYMMDDHHmmSSOHH'mm'

Returns: a formatted date

setLength

private String setLength(int i, int length)
Adds a number of leading zeros to a given String in order to get a String of a certain length.

Parameters: i a given number length the length of the resulting String

Returns: the resulting String