/** * TODO: replace this method by using another one in core: * com.atlassian.confluence.content.render.xhtml.DefaultStorageFormatService#createStorageFormatForDate * The method is from CONF v5.6 onwards and that using the method will break backwards compatibility of meeting notes * * @return string that is represented a time tag */ public String createStorageFormatForToday() { ConfluenceUserPreferences preferences = userAccessor.getConfluenceUserPreferences(AuthenticatedUserThreadLocal.get()); DateFormatter dateFormatter = preferences.getDateFormatter(formatSettingsManager, localeManager); return String.format("<time datetime=\"%s\"></time>", dateFormatter.formatGivenString(STORAGE_DATE_FORMAT, new Date())); } }
public String render(long time, boolean showTime) { // time might be zero for upgraded tasks that didn't have completion // or created dates if (time == 0) { return "N/A"; } final ConfluenceUser user = AuthenticatedUserThreadLocal.get(); final DateFormatter formatter = userAccessor.getConfluenceUserPreferences(user) .getDateFormatter(formatSettingsManager, localeManager); if (showTime) { return formatter.formatDateTime(new Date(time)); } else { return formatter.format(new Date(time)); } } }
public String getFormattedLocalDate(String dateFormat) { Date today = new Date(); ConfluenceUserPreferences preferences = userAccessor.getConfluenceUserPreferences(getUser()); DateFormatter dateFormatter = preferences.getDateFormatter(formatSettingsManager, localeManager); if (null == dateFormat) { return dateFormatter.format(today); } else { return dateFormatter.formatGivenString(dateFormat, today); } }
DateFormatter df = pref.getDateFormatter(formatSettingsManager, localeManager); contextMap.put("dateFormatter", df); contextMap.put("spaceKey", spaceKey);
final DateFormatter dateFormatter = pref.getDateFormatter(formatSettingsManager, localeManager); final UpdateItemFactory updateItemFactory = new DefaultUpdateItemFactory(dateFormatter, i18n, contentTypesDisplayMapper);