|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.cometway.util.DateTools
public class DateTools
Set of utilities for manipulating date info.
| Field Summary | |
|---|---|
protected static java.lang.String[] |
daysTable
|
static java.text.SimpleDateFormat |
ISO8601_DATEFORMAT
|
static java.text.SimpleDateFormat |
ISO8601_DATETIMEFORMAT
|
static java.text.SimpleDateFormat |
ISO8601_TIMEFORMAT
|
static int |
kDaysPerWeek
|
static int |
kMonthsPerYear
|
protected static java.lang.String[] |
monthsTable
|
| Constructor Summary | |
|---|---|
DateTools()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
getAbbrDate(java.util.Date date)
Returns a date string in this formate: MMM D, YYYY or MMM DD, YYYY where M=month, D=date, and Y = year. |
static java.lang.String |
getAbbrDate(java.util.Date date,
java.util.TimeZone tz)
|
static java.lang.String |
getDay(int theDay)
Retuns a string of the Day, no abbreviation, given the day int. |
static java.lang.String |
getDay(int theDay,
int maxLength)
Returns a string of the Day, abbreivate to maxLength characters. |
static java.lang.String |
getLongDate(java.util.Date date)
Returns a date string like getAbbrDate except the month is not abbreviated. |
static java.lang.String |
getLongDate(java.util.Date date,
java.util.TimeZone tz)
|
static java.lang.String |
getMonth(int theMonth)
get the String name of the month from the int value of the month (0-11) |
static java.lang.String |
getMonth(int theMonth,
int maxLength)
get the String name of the month and truncate it to maxLength if needed |
static java.lang.String |
getShortDate(java.util.Date date)
returns a date string in the format: MM/DD/YY, where MM is the month int+1, DD is the date, and YY is the year. |
static java.lang.String |
getShortDate(java.util.Date date,
java.util.TimeZone tz)
|
static java.lang.String |
getShortDateTime(java.util.Date date,
boolean wantYear,
boolean wantSeconds)
returns an abbreviated date string with the time |
static java.lang.String |
getShortDateTime(java.util.Date date,
boolean wantYear,
boolean wantSeconds,
java.util.TimeZone tz)
|
static java.lang.String |
getTime(java.util.Date date,
boolean wantSeconds)
returns a time string |
static java.lang.String |
getTime(java.util.Date date,
boolean wantSeconds,
java.util.TimeZone tz)
|
static java.util.Date |
parseISO8601String(java.lang.String dateStr)
|
static java.util.Date |
today()
|
static java.lang.String |
toISO8601String(java.util.Date d)
|
static java.lang.String |
toRFC822String(java.util.Date inDate)
Returns a date string specified by RFC 822: \"Standard for the format of ARPA Internet Messages\". |
static java.lang.String |
toRFC822String(java.util.Date inDate,
java.util.TimeZone tz)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int kDaysPerWeek
public static final int kMonthsPerYear
protected static final java.lang.String[] daysTable
protected static final java.lang.String[] monthsTable
public static final java.text.SimpleDateFormat ISO8601_DATETIMEFORMAT
public static final java.text.SimpleDateFormat ISO8601_DATEFORMAT
public static final java.text.SimpleDateFormat ISO8601_TIMEFORMAT
| Constructor Detail |
|---|
public DateTools()
| Method Detail |
|---|
public static java.lang.String toISO8601String(java.util.Date d)
public static java.util.Date parseISO8601String(java.lang.String dateStr)
throws java.text.ParseException
java.text.ParseExceptionpublic static java.lang.String getAbbrDate(java.util.Date date)
date - This is the date object to convert to string.
public static java.lang.String getAbbrDate(java.util.Date date,
java.util.TimeZone tz)
public static java.lang.String getDay(int theDay)
public static java.lang.String getDay(int theDay,
int maxLength)
public static java.lang.String getLongDate(java.util.Date date)
public static java.lang.String getLongDate(java.util.Date date,
java.util.TimeZone tz)
public static java.lang.String getMonth(int theMonth)
public static java.lang.String getMonth(int theMonth,
int maxLength)
public static java.lang.String getShortDate(java.util.Date date)
public static java.lang.String getShortDate(java.util.Date date,
java.util.TimeZone tz)
public static java.lang.String getShortDateTime(java.util.Date date,
boolean wantYear,
boolean wantSeconds)
public static java.lang.String getShortDateTime(java.util.Date date,
boolean wantYear,
boolean wantSeconds,
java.util.TimeZone tz)
public static java.lang.String getTime(java.util.Date date,
boolean wantSeconds)
public static java.lang.String getTime(java.util.Date date,
boolean wantSeconds,
java.util.TimeZone tz)
public static java.util.Date today()
public static java.lang.String toRFC822String(java.util.Date inDate)
inDate - This is the Date to turn into a string, null will give current date
public static java.lang.String toRFC822String(java.util.Date inDate,
java.util.TimeZone tz)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||