java.lang.Object | |
↳ | java.util.Date |
Known Direct Subclasses |
Date
represents a specific moment in time, to the millisecond.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Initializes this
Date instance to the current time. | |||||||||||
This constructor is deprecated.
use
GregorianCalendar(int, int, int)
| |||||||||||
This constructor is deprecated.
use
GregorianCalendar(int, int, int, int, int)
| |||||||||||
This constructor is deprecated.
use
GregorianCalendar(int, int, int, int, int, int)
| |||||||||||
Initializes this
Date instance using the specified millisecond value. | |||||||||||
This constructor is deprecated.
use
DateFormat
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
use:
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.set(year + 1900, month, day, hour, minute, second);
cal.getTime().getTime();
| |||||||||||
Returns if this
Date is after the specified Date. | |||||||||||
Returns if this
Date is before the specified Date. | |||||||||||
Returns a new
Date with the same millisecond value as this Date . | |||||||||||
Compare the receiver to the specified
Date to determine the relative
ordering. | |||||||||||
Compares the specified object to this
Date and returns if they are equal. | |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.DATE)
| |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.DAY_OF_WEEK)
| |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.HOUR_OF_DAY)
| |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.MINUTE)
| |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.MONTH)
| |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.SECOND)
| |||||||||||
Returns this
Date as a millisecond value. | |||||||||||
This method is deprecated.
use
(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / 60000
| |||||||||||
This method is deprecated.
use
Calendar.get(Calendar.YEAR) - 1900
| |||||||||||
Returns an integer hash code for the receiver.
| |||||||||||
This method is deprecated.
use
DateFormat
| |||||||||||
This method is deprecated.
use
Calendar.set(Calendar.DATE, day)
| |||||||||||
This method is deprecated.
use
Calendar.set(Calendar.HOUR_OF_DAY, hour)
| |||||||||||
This method is deprecated.
use
Calendar.set(Calendar.MINUTE, minute)
| |||||||||||
This method is deprecated.
use
Calendar.set(Calendar.MONTH, month)
| |||||||||||
This method is deprecated.
use
Calendar.set(Calendar.SECOND, second)
| |||||||||||
Sets this
Date to the specified millisecond value. | |||||||||||
This method is deprecated.
use
Calendar.set(Calendar.YEAR, year + 1900)
| |||||||||||
This method is deprecated.
use
DateFormat
| |||||||||||
This method is deprecated.
use
DateFormat
| |||||||||||
Returns a string representation of this
Date . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.Comparable
|
This constructor is deprecated.
use
GregorianCalendar(int, int, int)
Constructs a new Date
initialized to midnight in the default TimeZone
on
the specified date.
year | the year, 0 is 1900. |
---|---|
month | the month, 0 - 11. |
day | the day of the month, 1 - 31. |
This constructor is deprecated.
use
GregorianCalendar(int, int, int, int, int)
Constructs a new Date
initialized to the specified date and time in the
default TimeZone
.
year | the year, 0 is 1900. |
---|---|
month | the month, 0 - 11. |
day | the day of the month, 1 - 31. |
hour | the hour of day, 0 - 23. |
minute | the minute of the hour, 0 - 59. |
This constructor is deprecated.
use
GregorianCalendar(int, int, int, int, int, int)
Constructs a new Date
initialized to the specified date and time in the
default TimeZone
.
year | the year, 0 is 1900. |
---|---|
month | the month, 0 - 11. |
day | the day of the month, 1 - 31. |
hour | the hour of day, 0 - 23. |
minute | the minute of the hour, 0 - 59. |
second | the second of the minute, 0 - 59. |
Initializes this Date
instance using the specified millisecond value. The
value is the number of milliseconds since Jan. 1, 1970 GMT.
milliseconds | the number of milliseconds since Jan. 1, 1970 GMT. |
---|
This constructor is deprecated.
use DateFormat
Constructs a new Date
initialized to the date and time parsed from the
specified String.
string | the String to parse. |
---|
This method is deprecated.
use:
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.set(year + 1900, month, day, hour, minute, second);
cal.getTime().getTime();
Returns the millisecond value of the specified date and time in GMT.
year | the year, 0 is 1900. |
---|---|
month | the month, 0 - 11. |
day | the day of the month, 1 - 31. |
hour | the hour of day, 0 - 23. |
minute | the minute of the hour, 0 - 59. |
second | the second of the minute, 0 - 59. |
Returns if this Date
is after the specified Date.
date | a Date instance to compare. |
---|
true
if this Date
is after the specified Date
,
false
otherwise.
Returns if this Date
is before the specified Date.
date | a Date instance to compare. |
---|
true
if this Date
is before the specified Date
,
false
otherwise.
Returns a new Date
with the same millisecond value as this Date
.
Date
.Compare the receiver to the specified Date
to determine the relative
ordering.
date | a Date to compare against. |
---|
int < 0
if this Date
is less than the specified Date
, 0
if
they are equal, and an int > 0
if this Date
is greater.
Compares the specified object to this Date
and returns if they are equal.
To be equal, the object must be an instance of Date
and have the same millisecond
value.
object | the object to compare with this object. |
---|
true
if the specified object is equal to this Date
, false
otherwise.
This method is deprecated.
use Calendar.get(Calendar.DATE)
Returns the gregorian calendar day of the month for this Date
object.
This method is deprecated.
use Calendar.get(Calendar.DAY_OF_WEEK)
Returns the gregorian calendar day of the week for this Date
object.
This method is deprecated.
use Calendar.get(Calendar.HOUR_OF_DAY)
Returns the gregorian calendar hour of the day for this Date
object.
This method is deprecated.
use Calendar.get(Calendar.MINUTE)
Returns the gregorian calendar minute of the hour for this Date
object.
This method is deprecated.
use Calendar.get(Calendar.MONTH)
Returns the gregorian calendar month for this Date
object.
This method is deprecated.
use Calendar.get(Calendar.SECOND)
Returns the gregorian calendar second of the minute for this Date
object.
Returns this Date
as a millisecond value. The value is the number of
milliseconds since Jan. 1, 1970, midnight GMT.
This method is deprecated.
use
(Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / 60000
Returns the timezone offset in minutes of the default TimeZone
.
TimeZone
.
This method is deprecated.
use Calendar.get(Calendar.YEAR) - 1900
Returns the gregorian calendar year since 1900 for this Date
object.
Returns an integer hash code for the receiver. Objects which are equal return the same value for this method.
Date
's hash.
This method is deprecated.
use DateFormat
Returns the millisecond value of the date and time parsed from the
specified String
. Many date/time formats are recognized, including IETF
standard syntax, i.e. Tue, 22 Jun 1999 12:16:00 GMT-0500
string | the String to parse. |
---|
This method is deprecated.
use Calendar.set(Calendar.DATE, day)
Sets the gregorian calendar day of the month for this Date
object.
day | the day of the month. |
---|
This method is deprecated.
use Calendar.set(Calendar.HOUR_OF_DAY, hour)
Sets the gregorian calendar hour of the day for this Date
object.
hour | the hour of the day. |
---|
This method is deprecated.
use Calendar.set(Calendar.MINUTE, minute)
Sets the gregorian calendar minute of the hour for this Date
object.
minute | the minutes. |
---|
This method is deprecated.
use Calendar.set(Calendar.MONTH, month)
Sets the gregorian calendar month for this Date
object.
month | the month. |
---|
This method is deprecated.
use Calendar.set(Calendar.SECOND, second)
Sets the gregorian calendar second of the minute for this Date
object.
second | the seconds. |
---|
Sets this Date
to the specified millisecond value. The value is the
number of milliseconds since Jan. 1, 1970 GMT.
milliseconds | the number of milliseconds since Jan. 1, 1970 GMT. |
---|
This method is deprecated.
use Calendar.set(Calendar.YEAR, year + 1900)
Sets the gregorian calendar year since 1900 for this Date
object.
year | the year since 1900. |
---|
This method is deprecated.
use DateFormat
Returns the string representation of this Date
in GMT in the format: 22
Jun 1999 13:02:00 GMT
Date
in GMT.
This method is deprecated.
use DateFormat
Returns the string representation of this Date
for the default Locale
.
Date
for the default Locale
.Returns a string representation of this Date
.
The formatting is equivalent to using a SimpleDateFormat
with
the format string "EEE MMM dd HH:mm:ss zzz yyyy", which looks something
like "Tue Jun 22 13:07:00 PDT 1999". The current default time zone and
locale are used. If you need control over the time zone or locale,
use SimpleDateFormat
instead.
Date
.