/** * Returns a formated date and time String from a Date value, * the format being {@link DateFormat#SHORT} and the locale * based on this instance.<p> * * @param date the Date object to format as String * @return the formatted date and time */ public String getDateTime(Date date) { return CmsDateUtil.getDateTime(date, DateFormat.SHORT, m_locale); }
/** * Returns a formated date and time String from a Date value, * the formatting based on the provided option and the locale * based on this instance.<p> * * @param date the Date object to format as String * @param format the format to use, see {@link CmsMessages} for possible values * @return the formatted date and time */ public String getDateTime(Date date, int format) { return CmsDateUtil.getDateTime(date, format, m_locale); }
/** * Returns a formated date and time String from a Date value, * the format being {@link DateFormat#SHORT} and the locale * based on this instance.<p> * * @param date the Date object to format as String * @return the formatted date and time */ public String getDateTime(Date date) { return CmsDateUtil.getDateTime(date, DateFormat.SHORT, m_locale); }
/** * Returns a formated date and time String from a Date value, * the formatting based on the provided option and the locale * based on this instance.<p> * * @param date the Date object to format as String * @param format the format to use, see {@link CmsMessages} for possible values * @return the formatted date and time */ public String getDateTime(Date date, int format) { return CmsDateUtil.getDateTime(date, format, m_locale); }
/** * Returns a formated date and time String from a timestamp value, * the format being {@link DateFormat#SHORT} and the locale * based on this instance.<p> * * @param time the time value to format as date * @return the formatted date and time */ public String getDateTime(long time) { return CmsDateUtil.getDateTime(new Date(time), DateFormat.SHORT, m_locale); }
/** * Returns a formated date and time String from a timestamp value, * the format being {@link DateFormat#SHORT} and the locale * based on this instance.<p> * * @param time the time value to format as date * @return the formatted date and time */ public String getDateTime(long time) { return CmsDateUtil.getDateTime(new Date(time), DateFormat.SHORT, m_locale); }
/** * Returns a formated date and time String form a timestamp value, * the formatting based on the OpenCms system default locale * and the {@link DateFormat#SHORT} date format.<p> * * @param time the time value to format as date * @return the formatted date */ public static String getDateTimeShort(long time) { return getDateTime(new Date(time), DateFormat.SHORT, CmsLocaleManager.getDefaultLocale()); }
/** * Returns a formated date and time String form a timestamp value, * the formatting based on the OpenCms system default locale * and the {@link DateFormat#SHORT} date format.<p> * * @param time the time value to format as date * @return the formatted date */ public static String getDateTimeShort(long time) { return getDateTime(new Date(time), DateFormat.SHORT, CmsLocaleManager.getDefaultLocale()); }
/** * Returns the server Time.<p> * * @return the server Time */ public String getServerTime() { if (m_serverTime == null) { m_serverTime = CmsDateUtil.getDateTime(new Date(), DateFormat.LONG, getLocale()); } return m_serverTime; }
/** * Formats a date given the current user's workplace locale.<p> * * @param cms the current CMS context * @param date the date to format * * @return the formatted date */ public static String formatDateTime(CmsObject cms, long date) { return CmsDateUtil.getDateTime( new Date(date), DateFormat.MEDIUM, OpenCms.getWorkplaceManager().getWorkplaceLocale(cms)); }
/** * Creates the publish project's name for a given root path and publish date.<p> * * @param rootPath the publish resource's root path * @param date the publish date * * @return the publish project name */ protected String computeProjectName(String rootPath, Date date) { // create the temporary project, which is deleted after publishing // the publish scheduled date in project name String dateTime = CmsDateUtil.getDateTime(date, DateFormat.SHORT, getLocale()); // the resource name to publish scheduled String projectName = key(Messages.GUI_PUBLISH_SCHEDULED_PROJECT_NAME_2, new Object[] {rootPath, dateTime}); // the HTML encoding for slashes is necessary because of the slashes in english date time format // in project names slahes are not allowed, because these are separators for organizaional units projectName = projectName.replace("/", "/"); return projectName; }
/** * Creates the publish project's name for a given root path and publish date.<p> * * @param rootPath the publish resource's root path * @param date the publish date * * @return the publish project name */ private String computeProjectName(String rootPath, Date date) { // create the temporary project, which is deleted after publishing // the publish scheduled date in project name String dateTime = CmsDateUtil.getDateTime(date, DateFormat.SHORT, getLocale()); // the resource name to publish scheduled String projectName = CmsVaadinUtils.getMessageText( Messages.GUI_PUBLISH_SCHEDULED_PROJECT_NAME_2, rootPath, dateTime); // the HTML encoding for slashes is necessary because of the slashes in english date time format // in project names slahes are not allowed, because these are separators for organizaional units projectName = projectName.replace("/", "/"); while (projectName.length() > 190) { rootPath = "..." + rootPath.substring(5, rootPath.length()); projectName = computeProjectName(rootPath, date); } return projectName; }
/** * Formats an xml content value string for display in the value comparison table.<p> * * @param cms the CMS context * @param comparison the element comparison * @param origValue the XML content value as a string * * @return the formatted string */ public static String formatContentValueForDiffTable( CmsObject cms, CmsElementComparison comparison, String origValue) { String result = CmsStringUtil.substitute(CmsStringUtil.trimToSize(origValue, 60), "\n", ""); // formatting DateTime if (comparison instanceof CmsXmlContentElementComparison) { if (((CmsXmlContentElementComparison)comparison).getType().equals(CmsXmlDateTimeValue.TYPE_NAME)) { if (CmsStringUtil.isNotEmpty(result)) { result = CmsDateUtil.getDateTime( new Date(Long.parseLong(result)), DateFormat.SHORT, cms.getRequestContext().getLocale()); } } } return result; }
public static String formatContentValueForDiffTable( CmsObject cms, CmsElementComparison comparison, String origValue) { String result = CmsStringUtil.escapeHtml( CmsStringUtil.substitute( CmsStringUtil.trimToSize(origValue, CmsPropertyComparisonList.TRIM_AT_LENGTH), "\n", "")); // formatting DateTime if (comparison instanceof CmsXmlContentElementComparison) { if (((CmsXmlContentElementComparison)comparison).getType().equals(CmsXmlDateTimeValue.TYPE_NAME)) { if (CmsStringUtil.isNotEmpty(result)) { result = CmsDateUtil.getDateTime( new Date(Long.parseLong(result)), DateFormat.SHORT, cms.getRequestContext().getLocale()); } } } return result; }
release1 = "-"; } else { release1 = CmsDateUtil.getDateTime( new Date(resource1.getDateReleased()), DateFormat.SHORT, release2 = "-"; } else { release2 = CmsDateUtil.getDateTime( new Date(resource2.getDateReleased()), DateFormat.SHORT, expire1 = "-"; } else { expire1 = CmsDateUtil.getDateTime( new Date(resource1.getDateExpired()), DateFormat.SHORT, expire2 = "-"; } else { expire2 = CmsDateUtil.getDateTime( new Date(resource2.getDateExpired()), DateFormat.SHORT, String.valueOf(resource1.isInternal()), String.valueOf(resource2.isInternal()))); String dateLastModified1 = CmsDateUtil.getDateTime( new Date(resource1.getDateLastModified()), DateFormat.SHORT,
/** * @see org.opencms.workplace.CmsWidgetDialog#defineWidgets() */ @Override protected void defineWidgets() { setKeyPrefix(KEY_PREFIX); setFilename(getDownloadFile().getName()); setFilesize("" + getDownloadFile().length()); setFilepath(getDownloadFile().getAbsolutePath()); setFiledate( CmsDateUtil.getDateTime(new Date(getDownloadFile().lastModified()), DateFormat.MEDIUM, getLocale())); addWidget(new CmsWidgetDialogParameter(this, "filename", PAGES[0], new CmsDisplayWidget())); addWidget(new CmsWidgetDialogParameter(this, "filesize", PAGES[0], new CmsDisplayWidget())); addWidget(new CmsWidgetDialogParameter(this, "filepath", PAGES[0], new CmsDisplayWidget())); addWidget(new CmsWidgetDialogParameter(this, "filedate", PAGES[0], new CmsDisplayWidget())); }
if (((CmsXmlContentElementComparison)comparison).getType().equals(CmsXmlDateTimeValue.TYPE_NAME)) { if (CmsStringUtil.isNotEmpty(value1)) { value1 = CmsDateUtil.getDateTime( new Date(Long.parseLong(value1)), DateFormat.SHORT, if (CmsStringUtil.isNotEmpty(value2)) { value2 = CmsDateUtil.getDateTime( new Date(Long.parseLong(value2)), DateFormat.SHORT,
if (((CmsXmlContentElementComparison)comparison).getType().equals(CmsXmlDateTimeValue.TYPE_NAME)) { if (CmsStringUtil.isNotEmpty(value1)) { value1 = CmsDateUtil.getDateTime( new Date(Long.parseLong(value1)), DateFormat.SHORT,
String formattedDate = CmsDateUtil.getDateTime( date, DateFormat.MEDIUM,
Date lastModDate = searchResult.getDateLastModified(); if (lastModDate != null) { subTitle += " / " + CmsDateUtil.getDateTime(lastModDate, DateFormat.MEDIUM, wpLocale);