Example usage for Java java.util Date fields, constructors, methods, implement or subclass
The text is from its open source code.
Date(long date) Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. | |
Date(String s) Allocates a Date object and initializes it so that it represents the date and time indicated by the string s , which is interpreted as if by the Date#parse method. | |
Date() Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond. | |
Date(int year, int month, int date) Allocates a Date object and initializes it so that it represents midnight, local time, at the beginning of the day specified by the year , month , and date arguments. |
boolean | after(Date when) Tests if this date is after the specified date. |
boolean | before(Date when) Tests if this date is before the specified date. |
Object | clone() Return a copy of this object. |
int | compareTo(Date anotherDate) Compares two Dates for ordering. |
boolean | equals(Object obj) Compares two dates for equality. |
Date | from(Instant instant) Obtains an instance of Date from an Instant object. |
Class> | getClass() Returns the runtime class of this Object . |
int | getDate() Returns the day of the month represented by this Date object. |
int | getDay() Returns the day of the week represented by this date. |
int | getHours() Returns the hour represented by this Date object. |
int | getMinutes() Returns the number of minutes past the hour represented by this date, as interpreted in the local time zone. |
int | getMonth() Returns a number representing the month that contains or begins with the instant in time represented by this Date object. |
int | getSeconds() Returns the number of seconds past the minute represented by this date. |
long | getTime() Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object. |
int | getTimezoneOffset() Returns the offset, measured in minutes, for the local time zone relative to UTC that is appropriate for the time represented by this Date object. |
int | getYear() Returns a value that is the result of subtracting 1900 from the year that contains or begins with the instant in time represented by this Date object, as interpreted in the local time zone. |
int | hashCode() Returns a hash code value for this object. |
long | parse(String s) Attempts to interpret the string s as a representation of a date and time. |
void | setDate(int date) Sets the day of the month of this Date object to the specified value. |
void | setHours(int hours) Sets the hour of this Date object to the specified value. |
void | setMinutes(int minutes) Sets the minutes of this Date object to the specified value. |
void | setMonth(int month) Sets the month of this date to the specified value. |
void | setSeconds(int seconds) Sets the seconds of this Date to the specified value. |
void | setTime(long time) Sets this Date object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT. |
void | setYear(int year) Sets the year of this Date object to be the specified value plus 1900. |
String | toGMTString() Creates a string representation of this Date object of the form: where:d mon yyyy hh:mm:ss GMT
|
Instant | toInstant() Converts this Date object to an Instant . |
String | toLocaleString() Creates a string representation of this Date object in an implementation-dependent form. |
String | toString() Converts this Date object to a String of the form: where:dow mon dd hh:mm:ss zzz yyyy
|
long | UTC(int year, int month, int date, int hrs, int min, int sec) Determines the date and time based on the arguments. |