Package com.atlassian.jira.datetime
Interface DateTimeFormatterFactory
- All Known Implementing Classes:
DateTimeFormatterFactoryImpl
,DateTimeFormatterFactoryStub
This factory is used to create
DateTimeFormatter
instances within JIRA. By default a formatter will be
configured to use the JIRA default time zone, locale, and date style.- Since:
- 4.4
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new DateTimeFormatter that uses the JIRA default time zone, locale, andrelative
date style.
-
Method Details
-
formatter
DateTimeFormatter formatter()Creates a new DateTimeFormatter that uses the JIRA default time zone, locale, andrelative
date style. To get a "smart" formatter that automatically uses the time zone and locale of the currently logged in user, create a new formatter by callingDateTimeFormatter.forLoggedInUser()
on the formatter returned by this method, e.g.:DateTimeFormatter userFormatter = dateTimeFormatterFactory.formatter().forLoggedInUser();
Note that since JIRA 5.0 you can get aDateTimeFormatter
injected directly into your class (in that case there is no need to use this factory class).A formatter obtained in this fashion may be safely reused across requests.
- Returns:
- a new DateTimeFormatter
-