Copyright© 2008-2018 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(java.util.Calendar aCalendar)
Formats a calendar according to the ISO8601 specification.
|
String |
getCalendarAsString(String aFormatPattern,
java.util.Calendar aCalendar)
Formats the date of a calendar according to a
SimpleDateFormat pattern. |
String |
getDateAsISO8601String(java.util.Date aDate)
Formats a date according to the ISO8601 specification.
|
String |
getDateAsString(String aFormatPattern,
java.util.Date aDate)
Formats a date according to a
SimpleDateFormat pattern. |
String |
getEditorFormatPattern(java.util.Locale aLocale)
Gets the date format pattern used in the SiteVision editor for a specific Locale.
|
String getDateAsISO8601String(java.util.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 null
String getCalendarAsISO8601String(java.util.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 null
String getEditorFormatPattern(java.util.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, java.util.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
. If null
, default format is usedaDate
- the Date
String
representation of aDate
according to aFormatPattern
.
Returns null
if aDate
is null
.String getCalendarAsString(String aFormatPattern, java.util.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
. If null
, default format is usedaCalendar
- the Calendar
String
representation of the date of aCalendar
according to aFormatPattern
.
Returns null
if aDate
is null
.SiteVision - 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-2018 SiteVision AB, all rights reserved.