|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.core.DateFormatter
public class DateFormatter
Formats dates and times into a given timezone in a variety of formats. The actual formats
are provided by the FormatSettingsManager which is passed to the constructor.
| Constructor Summary | |
|---|---|
DateFormatter(TimeZone timeZone,
FormatSettingsManager formatSettingsManager)
Create a date formatter for the specified timezone. |
|
| Method Summary | |
|---|---|
java.lang.String |
format(java.util.Date date)
Formats the date and returns it as a string, using the date formatting pattern. |
java.lang.String |
formatBlogDate(java.util.Date date)
Formats the date as a blog posting date and returns it as a string. |
java.lang.String |
formatDateFull(java.util.Date date)
Formats the date and returns it as a string, using DateFormat.FULL as
the formatting pattern. |
java.lang.String |
formatDateTime(java.util.Date date)
Formats the date and returns it as a string, using the date-time formatting pattern. |
java.lang.String |
formatDay(java.util.Date date)
|
static java.lang.String |
formatMillis(long millis)
|
java.lang.String |
formatServerDate(java.util.Date date)
Same as format(Date), but doesn't perform time zone conversion. |
java.lang.String |
formatServerDateFull(java.util.Date date)
Same as formatDateFull(Date), but doesn't perform time zone conversion. |
java.lang.String |
formatServerDateTime(java.util.Date date)
Same as formatDateTime(Date), but doesn't perform time zone conversion. |
java.lang.String |
formatTime(java.util.Date date)
Formats the date and returns it as a string, using the time formatting pattern. |
java.util.Calendar |
getCalendar()
|
java.lang.String |
getCurrentDate()
|
java.lang.String |
getCurrentDateTime()
|
TimeZone |
getTimeZone()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DateFormatter(TimeZone timeZone,
FormatSettingsManager formatSettingsManager)
timeZone - the time zone in which dates will be formatted| Method Detail |
|---|
public java.lang.String format(java.util.Date date)
TimeZone specified in the constructor is used to convert the date
from server time to the user's local time.
public java.lang.String formatDateTime(java.util.Date date)
TimeZone specified in the constructor is used to convert the date
from server time to the user's local time.
public java.lang.String formatTime(java.util.Date date)
TimeZone specified in the constructor is used to convert the date
from server time to the user's local time.
public java.lang.String formatDay(java.util.Date date)
FormatSettingsManager.getDayFormat()public java.lang.String formatDateFull(java.util.Date date)
DateFormat.FULL as
the formatting pattern.
The TimeZone specified in the constructor is used to convert the date
from server time to the user's local time.
public java.lang.String formatServerDate(java.util.Date date)
format(Date), but doesn't perform time zone conversion.
This is typically used for formatting the posting dates of news items, which must
be represented the same for all users.
public java.lang.String formatServerDateTime(java.util.Date date)
formatDateTime(Date), but doesn't perform time zone conversion.
This is typically used for formatting the posting dates of news items, which must
be represented the same for all users.
public java.lang.String formatBlogDate(java.util.Date date)
TimeZone specified in the constructor,
but instead uses server's default time zone. A blog post date is part of its identifier,
therefore it must be consistent for all users.
public java.lang.String formatServerDateFull(java.util.Date date)
formatDateFull(Date), but doesn't perform time zone conversion.
This is typically used for formatting the posting dates of news items, which must
be represented the same for all users.
public java.lang.String getCurrentDateTime()
formatDateTime(Date)public java.lang.String getCurrentDate()
format(Date)public java.util.Calendar getCalendar()
TimeZone specified in the constructor.public TimeZone getTimeZone()
TimeZone provided when this formatter was created.public static java.lang.String formatMillis(long millis)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||