|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WDate
public class WDate
Class which holds a date on the gregorian calendar, specified as
day/month/year.
A valid date may be specified by year, month, and day of month (using the
WDate(int, int, int) constructor, or the
setDate(int year, int month, int day) method). When attempting to
specify an invalid date (with an impossible combination of year/month/date)
an IllegalArgumentException will be thrown.
The class provides a flexible way for converting between strings and dates.
Use toString() to convert to strings, and fromString() for parsing strings.
Both methods take a format string, and the same format syntax is supported by
both methods.
Simple operations are supported to compare dates, or to calculate with dates.
| Constructor Summary | |
|---|---|
WDate(java.util.Date date)
Specify a date by a Date object. |
|
WDate(int year,
int month,
int day)
Specify a date by year, month (1-12), and day (1-31) When the date is invalid, an IllegalArgumentException is thrown. |
|
WDate(int year,
int month,
int day,
int hour,
int minute,
int second)
Set a date by year, month (1-12), day (1-31), hour (0-23), minute (0-59), second (0 - 59) When the date is invalid, an IllegalArgumentException is thrown. |
|
WDate(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
Set a date by year, month (1-12), day (1-31), hour (0-23), minute (0-59), second (0 - 59), millisecond (0 - 999) When the date is invalid, an IllegalArgumentException is thrown. |
|
| Method Summary | |
|---|---|
WDate |
addDays(int ndays)
Add days to a date. |
WDate |
addMilliseconds(int nMilliseconds)
Adds milliseconds. |
WDate |
addMonths(int nmonths)
Add months to a date. |
WDate |
addSeconds(int nSeconds)
Adds seconds. |
WDate |
addYears(int nyears)
Add years to a date. |
boolean |
after(WDate when)
Tests if this date is after the specified date. |
boolean |
before(WDate when)
Tests if this date is after the specified date. |
int |
compareTo(WDate o)
Compares this WDate object with the specified WDate object for order. |
boolean |
equals(java.lang.Object other)
Compares two dates for equality. |
static WDate |
fromJulianDay(int jd)
Converts a Julian Day jd to a WDate. |
static WDate |
fromString(java.lang.String text)
Parse a WString to a date using a default format. |
static WDate |
fromString(java.lang.String text,
java.lang.String format)
Parse a String to a date using a specified format. |
static WDate |
getCurrentDate()
Construct a date for the current client date. |
static WDate |
getCurrentServerDate()
Construct a date for the current server date. |
java.util.Date |
getDate()
Returns the internal Date object. |
int |
getDay()
Day of month (1-31) |
int |
getDayOfWeek()
Day of week (1-7) |
int |
getDaysTo(WDate date)
Returns the number of days from this date to date. |
static java.lang.String |
getDefaultFormat()
Returns the default date format. |
int |
getHour()
Hour (0-24) |
static java.lang.String |
getLongDayName(int weekday)
Returns the long day name. |
static java.lang.String |
getLongMonthName(int month)
Returns the long month name. |
int |
getMillisecond()
Millisecond (0-999) |
int |
getMillisecondsTo(WDate d)
Returns the difference between to time values (in milliseconds). |
int |
getMinute()
Minute (0-59) |
int |
getMonth()
Month (1-12) |
int |
getSecond()
Second (0-59) |
int |
getSecondsTo(WDate d)
Returns the difference between to time values (in seconds). |
static java.lang.String |
getShortDayName(int weekday)
Returns the short day name. |
static java.lang.String |
getShortMonthName(int month)
Returns the short month name. |
java.lang.String |
getTimeTo(WDate other,
int minValue)
Returns the difference between two WDate values (as text). |
int |
getYear()
Year |
int |
hashCode()
Returns a hash code value for the object. |
void |
setDate(int year,
int month,
int day)
Set a date by year, month (1-12), day (1-31) When the new date is invalid, an IllegalArgumentException is thrown. |
void |
setDate(int year,
int month,
int day,
int hour,
int minute,
int second)
Set a date by year, month (1-12), and day (1-31), hour (0-23), minute (0-59), second (0 - 59). |
void |
setDate(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
Set a date by year, month (1-12), day (1-31), hour (0-23), minute (0-59), second (0 - 59), millisecond (0 - 999) When the new date is invalid, an IllegalArgumentException is thrown. |
void |
setTime(int hour,
int minute)
Set this date's time by hour (0-23) and minute (0-59). |
void |
setTime(int hour,
int minute,
int second)
Set this date's time by hour (0-23), minute (0-59) and second (0 - 59). |
void |
setTime(int hour,
int minute,
int second,
int millisecond)
Set this date's time by hour (0-23), minute (0-59), second (0 - 59) and millisecond (0 - 999). |
int |
toJulianDay()
Converts the date to a Julian day. |
java.lang.String |
toString()
Format this date to a String using a default format. |
java.lang.String |
toString(java.lang.String format)
Format this date to a WString using a specified format. |
java.lang.String |
toString(java.lang.String format,
boolean localized)
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public WDate(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
setDate(int year, int month, int day, int hour, int minute, int
second, int millisecond)
public WDate(int year,
int month,
int day,
int hour,
int minute,
int second)
setDate(int year, int month, int day, int hour, int minute, int
second)
public WDate(int year,
int month,
int day)
setDate(int year, int month, int day),
getYear(),
getMonth(),
getDay()public WDate(java.util.Date date)
| Method Detail |
|---|
public void setDate(int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
WDate(int year, int month, int day, int hour, int minute, int
second, int millisecond),
getYear(),
getMonth(),
getDay(),
getHour(),
getMinute(),
getSecond(),
getMillisecond()
public void setDate(int year,
int month,
int day)
setDate(int, int, int, int, int, int)
public void setDate(int year,
int month,
int day,
int hour,
int minute,
int second)
setDate(int, int, int, int, int, int, int)
public void setTime(int hour,
int minute,
int second,
int millisecond)
public void setTime(int hour,
int minute,
int second)
public void setTime(int hour,
int minute)
public WDate addSeconds(int nSeconds)
public WDate addMilliseconds(int nMilliseconds)
public WDate addDays(int ndays)
addMonths(int),
addYears(int)public WDate addMonths(int nmonths)
addDays(int),
addYears(int)public WDate addYears(int nyears)
addDays(int),
addMonths(int)public int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public int getSecond()
public int getMillisecond()
public int getSecondsTo(WDate d)
public int getMillisecondsTo(WDate d)
public int getDayOfWeek()
public int getDaysTo(WDate date)
public java.lang.String getTimeTo(WDate other,
int minValue)
getDaysTo(WDate),
getSecondsTo(WDate)public boolean before(WDate when)
when - - a date.
public boolean after(WDate when)
when - - a date.
public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic static java.lang.String getDefaultFormat()
public static WDate getCurrentDate()
public static WDate getCurrentServerDate()
public static java.lang.String getShortDayName(int weekday)
getLongDayName(int)public static java.lang.String getShortMonthName(int month)
getLongMonthName(int)public static java.lang.String getLongDayName(int weekday)
getShortDayName(int)public static java.lang.String getLongMonthName(int month)
getShortDayName(int)public static WDate fromString(java.lang.String text)
"Wed Aug 29 2007"
will be parsed as a date that equals a date
constructed as:
WDate d = new WDate(2007,8,29);
When the date could not be parsed or is not valid, null is returned.
fromString(String, String)
public static WDate fromString(java.lang.String text,
java.lang.String format)
toString(String format).
When the date could not be parsed or is not valid, null is returned.
toString(String format)public int toJulianDay()
fromJulianDay(int)public java.lang.String toString()
toString in class java.lang.ObjecttoString(String format),
fromString(String)public java.lang.String toString(java.lang.String format)
SimpleDateFormat.
public java.lang.String toString(java.lang.String format,
boolean localized)
public static WDate fromJulianDay(int jd)
toJulianDay()public java.util.Date getDate()
public int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(WDate o)
compareTo in interface java.lang.Comparable<WDate>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||