|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectblather.model.SimpleDate
public class SimpleDate
SimpleDate is a very simple representation of a calendar date and time. Notably, it only represents dates in the Gregorian calendar system (with American English month names) and does not account for separate time zones. However, it does validate that the date and time it stores are actually possible, given the Gregorian calendar and a 24-hour clock. (It will, however, be inaccurate for dates from before the introduction of the Gregorian calendar.)
| Field Summary | |
|---|---|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
SimpleDate(int month,
int day,
int year,
int hour,
int minute)
Constructs a SimpleDate with the given time values. |
|
| Method Summary | |
|---|---|
static SimpleDate |
arbitrary()
|
int |
compareTo(java.lang.Object o)
|
java.lang.String |
dateToString()
Returns a string representation of the date. |
int |
getDay()
|
int |
getHour()
|
int |
getMinute()
|
int |
getMonth()
|
int |
getYear()
|
boolean |
isValid()
Returns true if this SimpleDate is valid -- that is, does this SimpleDate correspond to a legitimate date in the Gregorian calendar? -- and false otherwise. |
static void |
main(java.lang.String[] args)
|
static SimpleDate |
now()
Creates a new SimpleDate object corresponding to the current time, in the Central time zone. |
static SimpleDate |
now(java.lang.String timezone)
Creates a new SimpleDate object corresponding to the current time, in the specified time zone. |
void |
setDay(int day)
|
void |
setHour(int hour)
|
void |
setMinute(int minute)
|
void |
setMonth(int month)
|
void |
setYear(int year)
|
java.lang.String |
timeToString()
Returns a string representation of the time. |
java.lang.String |
toString()
Returns a string representation of the date and time. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public SimpleDate(int month,
int day,
int year,
int hour,
int minute)
month - a month, between 1 and 12, inclusiveday - a day number, between 1 and the number of days in the given month and yearyear - a year numberhour - an hour, between 0 and 23minute - a minute, between 0 and 59| Method Detail |
|---|
public static SimpleDate now()
public static SimpleDate now(java.lang.String timezone)
public static SimpleDate arbitrary()
public boolean isValid()
public int getDay()
public int getHour()
public int getMinute()
public int getMonth()
public int getYear()
public void setDay(int day)
public void setHour(int hour)
public void setMinute(int minute)
public void setMonth(int month)
public void setYear(int year)
public java.lang.String timeToString()
public java.lang.String dateToString()
public java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
public int compareTo(java.lang.Object o)
compareTo in interface java.lang.Comparable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||