diff options
author | Jeremias Maerki <jeremias@apache.org> | 2004-04-03 08:30:08 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2004-04-03 08:30:08 +0000 |
commit | 046b03471d8ee542309b1d53b80f03ad3c5b61ab (patch) | |
tree | 213537b8a436a20c57eda90eda0ba566a92155ab /src/java/org/apache/fop/pdf/PDFObject.java | |
parent | b4e157217f616e85e8653f980d50a201d1789946 (diff) | |
download | xmlgraphics-fop-046b03471d8ee542309b1d53b80f03ad3c5b61ab.tar.gz xmlgraphics-fop-046b03471d8ee542309b1d53b80f03ad3c5b61ab.zip |
Bugzilla Bug 28078
PDFInfo fixed to output the correct timezone for the creation date.
Submitted by: Tomas Soucek <tomas.soucek.at.i.cz>
Patch not applied as given. I moved the formatting of the date/time into PDFObject avoiding the inner class.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197485 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFObject.java')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFObject.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFObject.java b/src/java/org/apache/fop/pdf/PDFObject.java index 272cd01c7..95047be14 100644 --- a/src/java/org/apache/fop/pdf/PDFObject.java +++ b/src/java/org/apache/fop/pdf/PDFObject.java @@ -21,6 +21,8 @@ package org.apache.fop.pdf; // Java import java.io.IOException; import java.io.OutputStream; +import java.text.SimpleDateFormat; +import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -221,5 +223,21 @@ public abstract class PDFObject { return buf; }*/ } + + /** Formatting pattern for PDF date */ + protected static final SimpleDateFormat DATE_FORMAT + = new SimpleDateFormat("'D:'yyyyMMddHHmmssZ"); + + /** + * Formats a date/time according to the PDF specification + * (D:YYYYMMDDHHmmSSOHH'mm'). + * @param time date/time value to format + * @return the requested String representation + */ + protected String formatDateTime(Date time) { + String s = DATE_FORMAT.format(time); + int i = s.length() - 2; + return s.substring(0, i) + "'" + s.substring(i) + "'"; + } } |