Class DateFormatServiceImpl
java.lang.Object
com.atlassian.confluence.api.impl.service.datetime.DateFormatServiceImpl
- All Implemented Interfaces:
DateFormatService
@Transactional(readOnly=true,
rollbackFor=ServiceException.class)
public class DateFormatServiceImpl
extends Object
implements DateFormatService
-
Constructor Summary
ConstructorsConstructorDescriptionDateFormatServiceImpl
(UserPreferencesAccessor userPreferencesAccessor, FormatSettingsManager formatSettingsManager, LocaleManager localeManager, I18NBeanFactory i18NBeanFactory, com.atlassian.core.util.Clock clock) -
Method Summary
Modifier and TypeMethodDescriptionFormat the given date in an appropriate format according to the user's locale.getFormattedRelativeTime
(Instant instant) Formats a date in a relative, friendly way.
-
Constructor Details
-
DateFormatServiceImpl
public DateFormatServiceImpl(UserPreferencesAccessor userPreferencesAccessor, FormatSettingsManager formatSettingsManager, LocaleManager localeManager, I18NBeanFactory i18NBeanFactory, com.atlassian.core.util.Clock clock)
-
-
Method Details
-
getFormattedDateByUserLocale
Description copied from interface:DateFormatService
Format the given date in an appropriate format according to the user's locale. This can be used to display date to the user. Note that this does not perform timezone conversion.- Specified by:
getFormattedDateByUserLocale
in interfaceDateFormatService
- Parameters:
date
- the date to format- Returns:
- the date formatted accordingly in the current user's locale
-
getDateFormatPatternForUser
- Specified by:
getDateFormatPatternForUser
in interfaceDateFormatService
- Returns:
- the date format pattern in a string according to the user's locale
-
getFormattedRelativeTime
Description copied from interface:DateFormatService
Formats a date in a relative, friendly way. For example, "2 minutes ago".- Specified by:
getFormattedRelativeTime
in interfaceDateFormatService
-