|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.web.util.OutlookDate
public class OutlookDate
Class to give a nice String representation of a date (inspired by Outlook)
Note: This class is not Threadsafe due to its use of DateFormat objects. Do not cache this object across Threads.
Field Summary | |
---|---|
static long |
DAY
|
static long |
HOUR
|
static long |
MINUTE
|
static int |
OTHER
|
static long |
SECOND
|
static int |
THIS_WEEK
|
static int |
TODAY
|
static int |
YESTERDAY
|
Constructor Summary | |
---|---|
OutlookDate(Locale locale)
|
Method Summary | |
---|---|
int |
daysAgo(Date date)
|
int |
daysAgo(Date oldDate,
Date newDate)
The method determines whether the date lies between now and previous midnight ( TODAY ), between now and the midnight before previous
(YESTERDAY ), or between now and 7 midnights ago
(THIS_WEEK ). |
void |
flushCache()
|
String |
format()
|
String |
format(Date date)
|
String |
format(Date date,
Locale remoteUserLocale)
Deprecated. Please use format(java.util.Date) instead. |
String |
formatDatePicker(Date date)
|
String |
formatDateTimePicker(Date date)
|
String |
formatDay(Date date)
|
String |
formatDMY(Date date)
|
String |
formatDMYHMS(Date date)
|
String |
formatIso8601(Date date)
Formats the given date into ISO8601 format. |
String |
formatIso8601Date(Date date)
Formats the given date into ISO8601 format. |
static String |
formatRss(Date date)
Format a date for RSS feeds. |
static String |
formatRssRfc822(Date date)
Formats a date using the correct RFC822 format as indicated in the RSS v2 specification and not using the MailDateFormat which is technically incorrect. |
String |
formatTime(Date date)
|
DateFormat |
getCompleteDateFormat()
This helper is here to assist with formatting emails etc, and should only be used by JIRAVelocityManager. |
String |
getCompleteDateTimeFormat()
|
String |
getDatePickerFormat()
|
String |
getDatePickerFormatSample(Date date)
|
String |
getDateTimePickerFormat()
|
String |
getDateTimePickerFormatSample(Date date)
|
Locale |
getLocale()
|
Date |
getNow()
Returns new date |
boolean |
isDatePickerDate(String value)
|
Date |
parseCompleteDateTime(String value)
|
Date |
parseDatePicker(String value)
|
Date |
parseDateTimePicker(String value)
|
static Date |
parseRss(String rssDate)
Parse a date from RSS feeds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long SECOND
public static final long MINUTE
public static final long HOUR
public static final long DAY
public static final int TODAY
public static final int YESTERDAY
public static final int THIS_WEEK
public static final int OTHER
Constructor Detail |
---|
public OutlookDate(Locale locale)
Method Detail |
---|
public Locale getLocale()
public void flushCache()
public String formatIso8601(Date date)
formatIso8601Date(java.util.Date)
method instead.
date
- date to format
public String formatIso8601Date(Date date)
formatIso8601(java.util.Date)
method instead.
date
- date to format
public String formatDMY(Date date)
public String formatDMYHMS(Date date)
public String formatTime(Date date)
public String formatDay(Date date)
public String formatDatePicker(Date date)
public String formatDateTimePicker(Date date)
public static String formatRss(Date date)
MailDateFormat
to format
the given date. Returns an empty string if null is passed in.
date
- date to format
public static String formatRssRfc822(Date date)
MailDateFormat
which is technically incorrect. MailDateFormat
will however parse this
format.
See http://cyber.law.harvard.edu/rss/rss.html
See http://asg.web.cmu.edu/rfc/rfc822.html#sec-5.1
Correct : Wed, 22 Aug 2007 10:00:10 +1000
Incorrect : Wed, 22 Aug 2007 10:00:10 +1000 (GMT+10:00)
date
- the date to format into a string
public static Date parseRss(String rssDate) throws ParseException
MailDateFormat
to parse
the date.
rssDate
- RSS date
ParseException
- if string parsing failspublic String format()
public String format(Date date)
public String format(Date date, Locale remoteUserLocale)
format(java.util.Date)
instead.
date
- date to formatremoteUserLocale
- this parameter is ignored
public Date getNow()
public int daysAgo(Date date)
public int daysAgo(Date oldDate, Date newDate)
TODAY
), between now and the midnight before previous
(YESTERDAY
), or between now and 7 midnights ago
(THIS_WEEK
). If the passed in date does not fall in any of the
mentioned ranges, the method returns OTHER
.
oldDate
- old datenewDate
- new date
TODAY
, YESTERDAY
, THIS_WEEK
or OTHER
public Date parseDatePicker(String value) throws ParseException
ParseException
public Date parseCompleteDateTime(String value) throws ParseException
ParseException
public Date parseDateTimePicker(String value) throws ParseException
ParseException
public String getDatePickerFormat()
public String getDatePickerFormatSample(Date date)
public String getDateTimePickerFormatSample(Date date)
public boolean isDatePickerDate(String value)
public String getDateTimePickerFormat()
public String getCompleteDateTimeFormat()
public DateFormat getCompleteDateFormat()
SimpleDateFormat
based on the run-time value of APKeys.JIRA_LF_DATE_COMPLETE
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |