Class DateFormatUtil

java.lang.Object
org.apache.xmlgraphics.util.DateFormatUtil

public final class DateFormatUtil extends Object
  • Field Details

  • Constructor Details

    • DateFormatUtil

      private DateFormatUtil()
  • Method Details

    • formatPDFDate

      public static String formatPDFDate(Date date, TimeZone timeZone)
      Formats the date according to PDF format. See section 3.8.2 of the PDF 1.4 specification.
      Parameters:
      date - The date time to format
      timeZone - The time zone used to format the date
      Returns:
      a formatted date according to PDF format (based on ISO 8824)
    • formatISO8601

      public static String formatISO8601(Date date, TimeZone timeZone)
      Formats the date according to ISO 8601 standard.
      Parameters:
      date - The date time to format
      timeZone - The time zone used to format the date
      Returns:
      a formatted date according to ISO 8601
    • createDateFormat

      private static DateFormat createDateFormat(String format, TimeZone timeZone)
    • 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 format
      dateFormat - The date format to use when outputting the date
      delimiter - The character used to separate the time zone difference hours and minutes
      endWithDelimiter - Determines whether the date string will end with the delimiter character
      Returns:
      the formatted date string
    • getOffsetInMinutes

      private static int getOffsetInMinutes(Calendar cal)
    • appendOffset

      private static void appendOffset(StringBuilder sb, char delimiter, int offset, boolean endWithDelimiter)
    • appendOffsetUTC

      private static void appendOffsetUTC(StringBuilder sb)
    • appendOffsetNoUTC

      private static void appendOffsetNoUTC(StringBuilder sb, char delimiter, int offset, boolean endWithDelimiter)
    • appendOffsetSign

      private static void appendOffsetSign(StringBuilder sb, int zoneOffsetHours)
    • appendPaddedNumber

      private static void appendPaddedNumber(StringBuilder sb, int number)
    • parseISO8601Date

      public static Date parseISO8601Date(String date)
      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

      private static String formatDateToParse(String date, String errorMessage)