Package org.apache.xmlgraphics.util
Class DateFormatUtil
java.lang.Object
org.apache.xmlgraphics.util.DateFormatUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
appendOffset
(StringBuilder sb, char delimiter, int offset, boolean endWithDelimiter) private static void
appendOffsetNoUTC
(StringBuilder sb, char delimiter, int offset, boolean endWithDelimiter) private static void
appendOffsetSign
(StringBuilder sb, int zoneOffsetHours) private static void
private static void
appendPaddedNumber
(StringBuilder sb, int number) private static DateFormat
createDateFormat
(String format, TimeZone timeZone) private static String
formatDate
(Date date, DateFormat dateFormat, char delimiter, boolean endWithDelimiter) Formats the date according to the specified format and returns as a string.private static String
formatDateToParse
(String date, String errorMessage) static String
formatISO8601
(Date date, TimeZone timeZone) Formats the date according to ISO 8601 standard.static String
formatPDFDate
(Date date, TimeZone timeZone) Formats the date according to PDF format.private static int
static Date
parseISO8601Date
(String date) Parses an ISO 8601 date and time value.
-
Field Details
-
ISO_8601_DATE_PATTERN
- See Also:
-
-
Constructor Details
-
DateFormatUtil
private DateFormatUtil()
-
-
Method Details
-
formatPDFDate
Formats the date according to PDF format. See section 3.8.2 of the PDF 1.4 specification.- Parameters:
date
- The date time to formattimeZone
- The time zone used to format the date- Returns:
- a formatted date according to PDF format (based on ISO 8824)
-
formatISO8601
Formats the date according to ISO 8601 standard.- Parameters:
date
- The date time to formattimeZone
- The time zone used to format the date- Returns:
- a formatted date according to ISO 8601
-
createDateFormat
-
formatDate
private static String formatDate(Date date, DateFormat dateFormat, char delimiter, boolean endWithDelimiter) Formats the date according to the specified format and returns as a string.- Parameters:
date
- The date / time object to formatdateFormat
- The date format to use when outputting the datedelimiter
- The character used to separate the time zone difference hours and minutesendWithDelimiter
- Determines whether the date string will end with the delimiter character- Returns:
- the formatted date string
-
getOffsetInMinutes
-
appendOffset
private static void appendOffset(StringBuilder sb, char delimiter, int offset, boolean endWithDelimiter) -
appendOffsetUTC
-
appendOffsetNoUTC
private static void appendOffsetNoUTC(StringBuilder sb, char delimiter, int offset, boolean endWithDelimiter) -
appendOffsetSign
-
appendPaddedNumber
-
parseISO8601Date
Parses an ISO 8601 date and time value.- Parameters:
date
- the date and time value as an ISO 8601 string- Returns:
- the parsed date/time
-
formatDateToParse
-