Class PdfDate
java.lang.Object
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfObject
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfString
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfDate
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:
-
Field Summary
FieldsFields inherited from class com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfString
encoding, hexWriting, objGen, objNum, originalBytes, value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CalendarConverts a PDF string representing a date into a Calendar.Gives the W3C format of the PdfDate.static StringgetW3CDate(String d) Gives the W3C format of the PdfDate.private StringsetLength(int i, int length) Adds a number of leading zeros to a givenStringin order to get aStringof a certain length.Methods inherited from class com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfString
decrypt, getBytes, getEncoding, getOriginalBytes, isHexWriting, isUnicode, setHexWriting, setObjNum, toPdf, toString, toUnicodeStringMethods inherited from class com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfObject
canBeInObjStm, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
Field Details
-
dateSpace
private static final int[] dateSpace
-
-
Constructor Details
-
PdfDate
Constructs aPdfDate-object.- Parameters:
d- the date that has to be turned into aPdfDate-object
-
PdfDate
public PdfDate()Constructs aPdfDate-object, representing the current day and time.
-
-
Method Details
-
setLength
Adds a number of leading zeros to a givenStringin order to get aStringof a certain length.- Parameters:
i- a given numberlength- the length of the resultingString- Returns:
- the resulting
String
-
getW3CDate
Gives the W3C format of the PdfDate.- Returns:
- a formatted date
-
getW3CDate
Gives the W3C format of the PdfDate.- Parameters:
d-- Returns:
- a formatted date
-
decode
Converts a PDF string representing a date into a Calendar.- Parameters:
s- the PDF string representing a date- Returns:
- a
Calendarrepresenting the date ornullif the string was not a date
-