com.atlassian.jira.util
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 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 Date instances that this class produces are always to be interpreted in the system time zone.

Since:
v4.4
See Also:
DateTimeStyle.DATE, DateTimeStyle.DATE_PICKER

Method Summary
 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.
 

Method Detail

format

String format(Date date)
Formats a date using the JIRA date format.

Parameters:
date - a Date
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

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


Copyright © 2002-2015 Atlassian. All Rights Reserved.