Interface DateFieldFormat

All Known Implementing Classes:
DateFieldFormatImpl

@ThreadSafe public interface DateFieldFormat
Helper for handling JIRA date fields. Dates in JIRA are displayed as day/month/year and are interpreted according to the date picker format. Even though we use java.util.Date instances internally, only the year/month/day are relevant in a date field. Dates are used in a few places throughout JIRA:
  • the issue due date
  • the date custom field
  • the project version release date
Since:
v4.4
See Also:
  • Method Details

    • format

      String format(Date date)
      Formats a date using the JIRA date format.
      Parameters:
      date - a Date
      Returns:
      a String containing a formatted date
    • formatDateInUserTimeZone

      String formatDateInUserTimeZone(Date date)
      Formats a date using the JIRA date format and in the timezone of the logged in user.
      Parameters:
      date - a Date
      Returns:
      a String containing a formatted date
    • formatDateInTimeZone

      String formatDateInTimeZone(Date date, TimeZone timeZone)
      Formats a date using the Jira date format and in the specified time zone.
      Parameters:
      date - a Date
      timeZone - a TimeZone to use for formatting
      Returns:
      a String containing a formatted date
    • formatDatePicker

      String formatDatePicker(Date date)
      Formats the given date for usage in a date picker.
      Parameters:
      date - a Date
      Returns:
      a String containing a formatted date
    • parseDatePicker

      Date parseDatePicker(String text) throws IllegalArgumentException
      Returns a date that is obtained by parsing the given text. The string representation of the date is assumed to be in the system time zone.
      Parameters:
      text - a String representation of a date
      Returns:
      a Date
      Throws:
      IllegalArgumentException - if the text cannot be parsed
    • parseDatePickerInUserTimeZone

      Date parseDatePickerInUserTimeZone(String text) throws IllegalArgumentException
      Returns a date that is obtained by parsing the given text. The string representation of the date is assumed to be in the time zone of the logged in user.
      Parameters:
      text - a String representation of a date
      Returns:
      a Date
      Throws:
      IllegalArgumentException - if the text cannot be parsed
    • parseDatePickerInUTC

      Date parseDatePickerInUTC(String text) throws IllegalArgumentException
      Returns a date that is obtained by parsing the given text. The string representation of the date is assumed to be in UTC.
      Parameters:
      text - a String representation of a date
      Returns:
      a Date
      Throws:
      IllegalArgumentException - if the text cannot be parsed
    • isParseable

      boolean isParseable(String text)
      Returns a boolean indicating whether the given text contains a valid date.
      Parameters:
      text - a String representation of a date
      Returns:
      a boolean indicating whether the given text contains a valid date
    • getFormatHint

      String getFormatHint()
      Returns a string containing the format that this class is capable of parsing.
      Returns:
      a String containing the format hint