protected Calendar getBlogPostPublishedDate( int yearPublished, int monthPublished, int dayPublished) { Calendar publishedDate = Calendar.getInstance( userAccessor.getConfluenceUserPreferences( AuthenticatedUserThreadLocal.getUser() ).getTimeZone().getWrappedTimeZone() ); publishedDate.set(yearPublished, monthPublished - 1, dayPublished); return publishedDate; }
/** * 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())); } }
protected Calendar getUserDateWithTimeZone() { return Calendar.getInstance( userAccessor.getConfluenceUserPreferences( AuthenticatedUserThreadLocal.getUser() ).getTimeZone().getWrappedTimeZone() ); }
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); } }
ConfluenceUserPreferences pref = userAccessor.getConfluenceUserPreferences(user); DateFormatter df = pref.getDateFormatter(formatSettingsManager, localeManager); contextMap.put("dateFormatter", df);
private FriendlyDateFormatter createFriendlyDateFormatter(final User user) { final ConfluenceUserPreferences pref = userAccessor.getConfluenceUserPreferences(user); final DateFormatter dateFormatter = new DateFormatter(pref.getTimeZone(), formatSettingsManager, localeManager); return new FriendlyDateFormatter(getTimeOrNow(), dateFormatter); }
new DateFormatter(userAccessor.getConfluenceUserPreferences(currentUser).getTimeZone(), formatSettingsManager, localeManager))); } finally {
public DateTimeZone getUserTimeZone() { User user = AuthenticatedUserThreadLocal.getUser(); final ConfluenceUserPreferences userPreferences = userAccessor.getConfluenceUserPreferences(user); try { return DateTimeZone.forTimeZone(userPreferences.getTimeZone().getWrappedTimeZone()); } catch (IllegalArgumentException e) { return DateTimeZone.getDefault(); } }
final ConfluenceUserPreferences pref = userAccessor.getConfluenceUserPreferences(AuthenticatedUserThreadLocal.get()); final DateFormatter dateFormatter = pref.getDateFormatter(formatSettingsManager, localeManager); final UpdateItemFactory updateItemFactory = new DefaultUpdateItemFactory(dateFormatter, i18n, contentTypesDisplayMapper);