|
Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Date
public class Date
Date represents a specific moment in time, to the millisecond.
System.currentTimeMillis(),
Calendar,
GregorianCalendar,
SimpleTimeZone,
TimeZone,
Serialized Form| Constructor Summary | |
|---|---|
Date()
Initializes this Date instance to the current date and time. |
|
Date(int year,
int month,
int day)
Deprecated. use GregorianCalendar(int, int, int) |
|
Date(int year,
int month,
int day,
int hour,
int minute)
Deprecated. use GregorianCalendar(int, int, int, int, int) |
|
Date(int year,
int month,
int day,
int hour,
int minute,
int second)
Deprecated. use GregorianCalendar(int, int, int, int, int, int) |
|
Date(long milliseconds)
Initializes this Date instance using the specified millisecond value. |
|
Date(String string)
Deprecated. use DateFormat |
|
| Method Summary | |
|---|---|
boolean |
after(Date date)
Answers if this Date is after the specified Date. |
boolean |
before(Date date)
Answers if this Date is before the specified Date. |
Object |
clone()
Answers a new Date with the same millisecond value as this Date. |
int |
compareTo(Date date)
Compare the receiver to the specified Date to determine the relative ordering. |
int |
compareTo(Object object)
Compare the receiver to the specified Object to determine the relative ordering. |
boolean |
equals(Object object)
Compares the specified object to this Date and answer if they are equal. |
int |
getDate()
Deprecated. use Calendar.get(Calendar.DATE) |
int |
getDay()
Deprecated. use Calendar.get(Calendar.DAY_OF_WEEK) |
int |
getHours()
Deprecated. use Calendar.get(Calendar.HOUR_OF_DAY) |
int |
getMinutes()
Deprecated. use Calendar.get(Calendar.MINUTE) |
int |
getMonth()
Deprecated. use Calendar.get(Calendar.MONTH) |
int |
getSeconds()
Deprecated. use Calendar.get(Calendar.SECOND) |
long |
getTime()
Answers this Date as a millisecond value. |
int |
getTimezoneOffset()
Deprecated. use (Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / 60000 |
int |
getYear()
Deprecated. use Calendar.get(Calendar.YEAR) - 1900 |
int |
hashCode()
Answers an integer hash code for the receiver. |
static long |
parse(String string)
Deprecated. use DateFormat |
void |
setDate(int day)
Deprecated. use Calendar.set(Calendar.DATE, day) |
void |
setHours(int hour)
Deprecated. use Calendar.set(Calendar.HOUR_OF_DAY, hour) |
void |
setMinutes(int minute)
Deprecated. use Calendar.set(Calendar.MINUTE, minute) |
void |
setMonth(int month)
Deprecated. use Calendar.set(Calendar.MONTH, month) |
void |
setSeconds(int second)
Deprecated. use Calendar.set(Calendar.SECOND, second) |
void |
setTime(long milliseconds)
Sets this Date to the specified millisecond value. |
void |
setYear(int year)
Deprecated. use Calendar.set(Calendar.YEAR, year + 1900) |
String |
toGMTString()
Deprecated. use DateFormat |
String |
toLocaleString()
Deprecated. use DateFormat |
String |
toString()
Answers the string representation of this Date in the format: Tue Jun 22 13:07:00 GMT 1999 |
static long |
UTC(int year,
int month,
int day,
int hour,
int minute,
int second)
Deprecated. use:
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.set(year + 1900, month, day, hour, minute, second);
cal.getTime().getTime(); |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Date()
public Date(int year,
int month,
int day)
year - the year, 0 is 1900month - the month, 0 - 11day - the day of the month, 1 - 31public Date(int year,
int month,
int day,
int hour,
int minute)
year - the year, 0 is 1900month - the month, 0 - 11day - the day of the month, 1 - 31hour - the hour of day, 0 - 23minute - the minute of the hour, 0 - 59public Date(int year,
int month,
int day,
int hour,
int minute,
int second)
year - the year, 0 is 1900month - the month, 0 - 11day - the day of the month, 1 - 31hour - the hour of day, 0 - 23minute - the minute of the hour, 0 - 59second - the second of the minute, 0 - 59public Date(long milliseconds)
milliseconds - the number of milliseconds since Jan. 1, 1970 GMTpublic Date(String string)
string - the String to parse| Method Detail |
|---|
public boolean after(Date date)
date - a Date instance to compare
public boolean before(Date date)
date - a Date instance to compare
public Object clone()
clone in class ObjectCloneablepublic int compareTo(Object object)
compareTo in interface Comparableobject - an Object
ClassCastException - when object is not a Datepublic int compareTo(Date date)
date - a Date
public boolean equals(Object object)
equals in class Objectobject - the object to compare with this object
hashCode()public int getDate()
public int getDay()
public int getHours()
public int getMinutes()
public int getMonth()
public int getSeconds()
public long getTime()
public int getTimezoneOffset()
(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / 60000
public int getYear()
public int hashCode()
hashCode in class Objectequals(java.lang.Object)public static long parse(String string)
string - the String to parse
public void setDate(int day)
day - the day of the monthpublic void setHours(int hour)
hour - the hour of the daypublic void setMinutes(int minute)
minute - the minutespublic void setMonth(int month)
month - the monthpublic void setSeconds(int second)
second - the secondspublic void setTime(long milliseconds)
milliseconds - the number of milliseconds since Jan. 1, 1970 GMT.public void setYear(int year)
year - the year since 1900public String toGMTString()
public String toLocaleString()
public String toString()
toString in class Objectpublic static long UTC(int year,
int month,
int day,
int hour,
int minute,
int second)
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.set(year + 1900, month, day, hour, minute, second);
cal.getTime().getTime();
year - the year, 0 is 1900month - the month, 0 - 11day - the day of the month, 1 - 31hour - the hour of day, 0 - 23minute - the minute of the hour, 0 - 59second - the second of the minute, 0 - 59
|
Final | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||