Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="DateUtil") public interface DateUtil
An instance of the Sitevision class implementing this interface can be obtained via Utils.getDateUtil().
See Utils for how to obtain an instance of the Utils interface.
| Modifier and Type | Method and Description |
|---|---|
String |
getCalendarAsISO8601String(Calendar aCalendar)
Formats a calendar according to the ISO8601 specification.
|
String |
getCalendarAsString(String aFormatPattern,
Calendar aCalendar)
Formats the date of a Calendar according to a
SimpleDateFormat pattern. |
String |
getCalendarAsString(String aFormatPattern,
Calendar aCalendar,
Locale aLocale)
Formats the date of a Calendar according to a
SimpleDateFormat pattern and a given Locale. |
String |
getDateAsISO8601String(Date aDate)
Formats a date according to the ISO8601 specification.
|
String |
getDateAsString(String aFormatPattern,
Date aDate)
Formats a Date according to a
SimpleDateFormat pattern. |
String |
getDateAsString(String aFormatPattern,
Date aDate,
Locale aLocale)
Formats a Date according to a
SimpleDateFormat pattern using a given Locale. |
String |
getEditorFormatPattern(Locale aLocale)
Gets the date format pattern used in the Sitevision editor for a specific Locale.
|
Date |
parseDate(String aDateStr,
String aFormatPattern)
Converts a date string to a Date using a
SimpleDateFormat pattern. |
Date |
parseDate(String aDateStr,
String aFormatPattern,
Locale aLocale)
Converts a date string to a Date using a
SimpleDateFormat pattern and a given Locale. |
Calendar |
toCalendar(Date aDate)
Converts a Date to a Calendar.
|
Date |
toDate(Calendar aCalendar)
Converts a Calendar to a Date.
|
String getDateAsISO8601String(Date aDate)
An example: A date representing february 3, 2001 at 04:45 in an +1h UTC timezone offset would be
ISO8601 formatted as 2001-02-03T04:05+01:00.
aDate - a Date that needs to be formattednull if aDate is nullString getCalendarAsISO8601String(Calendar aCalendar)
An example: A calendar representing february 3, 2001 at 04:45 in an +1h UTC timezone offset would be
ISO8601 formatted as 2001-02-03T04:05+01:00.
aCalendar - a Calendar that needs to be formattednull if aCalendar is nullString getEditorFormatPattern(Locale aLocale)
aLocale - the Locale that specifies the date format patternaLocale.
If aLocale is null then the current locale (as of
PortletContextUtil.getCurrentLocale())
is used to locate the format pattern. If no pattern exist for aLocale then the pattern that corresponds to
Locale.ENGLISH will be returned.String getDateAsString(String aFormatPattern, Date aDate)
SimpleDateFormat pattern.
Note! The current locale as of PortletContextUtil.getCurrentLocale() will be used.
If current locale is unavailable, Locale.getDefault() will be used.
aFormatPattern - date to string pattern according to SimpleDateFormat. Default pattern will be used if aFormatPattern is null or blankaDate - the DategetDateAsString(String, Date, Locale)String getDateAsString(String aFormatPattern, Date aDate, Locale aLocale)
SimpleDateFormat pattern using a given Locale.aFormatPattern - date to string pattern according to SimpleDateFormat. Default pattern will be used if aFormatPattern is null or blankaDate - the DateaLocale - the LocaleString getCalendarAsString(String aFormatPattern, Calendar aCalendar)
SimpleDateFormat pattern.
Note! The current locale as of PortletContextUtil.getCurrentLocale() will be used.
If current locale is unavailable, Locale.getDefault() will be used.
aFormatPattern - date to string pattern according to SimpleDateFormat. Default pattern will be used if aFormatPattern is null or blankaCalendar - the CalendargetCalendarAsString(String, Calendar, Locale)String getCalendarAsString(String aFormatPattern, Calendar aCalendar, Locale aLocale)
SimpleDateFormat pattern and a given Locale.aFormatPattern - date to string pattern according to SimpleDateFormat. Default pattern will be used if aFormatPattern is null or blankaCalendar - the CalendaraLocale - the LocaleCalendar toCalendar(Date aDate)
aDate - a DateDate toDate(Calendar aCalendar)
aCalendar - a CalendarDate parseDate(String aDateStr, String aFormatPattern)
SimpleDateFormat pattern.
Note! The current locale as of PortletContextUtil.getCurrentLocale() will be used.
If current locale is unavailable, Locale.getDefault() will be used.
aDateStr - the string representation of a DateaFormatPattern - string to date pattern according to SimpleDateFormatparseDate(String, String, Locale)Date parseDate(String aDateStr, String aFormatPattern, Locale aLocale)
SimpleDateFormat pattern and a given Locale.aDateStr - the string representation of a DateaFormatPattern - string to date pattern according to SimpleDateFormataLocale - the LocaleSitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.