java.lang.Object
org.sejda.sambox.util.DateConverter
Converts dates to strings and back using the PDF date standard in section 3.8.2 of PDF Reference
1.7.
- Author:
- Ben Litchfield, Fred Hansen
TODO Move members of this class elsewhere for shared use in pdfbox and xmpbox.
-
Method Summary
Modifier and TypeMethodDescriptionstatic CalendartoCalendar(String text) Returns the Calendar for a given string containing a date, ornullif it cannot be parsed.static CalendartoCalendar(COSString text) Returns the Calendar for a given COS string containing a date, ornullif it cannot be parsed.static StringConverts the date to ISO 8601 string format: yyyy-mm-ddThh:MM:ss#hh:mm (where '#" is '+' or '-').static StringConverts a Calendar to a string formatted as: D:yyyyMMddHHmmss#hh'mm' where # is Z, +, or -.
-
Method Details
-
toString
Converts a Calendar to a string formatted as: D:yyyyMMddHHmmss#hh'mm' where # is Z, +, or -.- Parameters:
cal- The date to convert to a string. May be null. The DST_OFFSET is included when computing the output time zone.- Returns:
- The date as a String to be used in a PDF document, or null if the cal value is null
-
toISO8601
Converts the date to ISO 8601 string format: yyyy-mm-ddThh:MM:ss#hh:mm (where '#" is '+' or '-').- Parameters:
cal- The date to convert. Must not be null. The DST_OFFSET is included in the output value.- Returns:
- The date represented as an ISO 8601 string.
-
toCalendar
Returns the Calendar for a given COS string containing a date, ornullif it cannot be parsed.The returned value will have 0 for DST_OFFSET.
- Parameters:
text- A COS string containing a date.- Returns:
- The Calendar that the text string represents, or
nullif it cannot be parsed.
-
toCalendar
Returns the Calendar for a given string containing a date, ornullif it cannot be parsed.The returned value will have 0 for DST_OFFSET.
- Parameters:
text- A COS string containing a date.- Returns:
- The Calendar that the text string represents, or
nullif it cannot be parsed.
-