@ThreadSafe public interface

DateFieldFormat

com.atlassian.jira.util.DateFieldFormat
Known Indirect Subclasses

Class Overview

Helper for handling JIRA date fields. Dates in JIRA are displayed as day/month/year and are intepreted 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

The Date instances that this class produces are always to be interpreted in the system time zone.

See Also

Summary

Public Methods
String format(Date date)
Formats a date using the JIRA date format.
String formatDatePicker(Date date)
Formats the given date for usage in a date picker.
String getFormatHint()
Returns a string containing the format that this class is capable of parsing.
boolean isParseable(String text)
Returns a boolean indicating whether the given text contains a valid date.
Date parseDatePicker(String text)
Returns a date that is obtained by parsing the given text.

Public Methods

public String format (Date date)

Formats a date using the JIRA date format.

Parameters
date a Date
Returns
  • a String containing a formatted date

public 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

public String getFormatHint ()

Returns a string containing the format that this class is capable of parsing.

Returns
  • a String containing the format hint

public 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

public Date parseDatePicker (String text)

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