Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » util » [javadoc | source]
java.util
public class: Date [javadoc | source]
java.lang.Object
   java.util.Date

All Implemented Interfaces:
    Comparable, Cloneable, Serializable

Direct Known Subclasses:
    Timestamp, Date, Time

{@code Date} represents a specific moment in time, to the millisecond.
Constructor:
 public Date() 
 public Date(long milliseconds) 
 public Date(String string) 
    Constructs a new {@code Date} initialized to the date and time parsed from the specified String.
    Parameters:
    string - the String to parse.
 public Date(int year,
    int month,
    int day) 
 public Date(int year,
    int month,
    int day,
    int hour,
    int minute) 
 public Date(int year,
    int month,
    int day,
    int hour,
    int minute,
    int second) 
Method from java.util.Date Summary:
UTC,   after,   before,   clone,   compareTo,   equals,   getDate,   getDay,   getHours,   getMinutes,   getMonth,   getSeconds,   getTime,   getTimezoneOffset,   getYear,   hashCode,   parse,   setDate,   setHours,   setMinutes,   setMonth,   setSeconds,   setTime,   setYear,   toGMTString,   toLocaleString,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.util.Date Detail:
 public 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();

    Returns the millisecond value of the specified date and time in GMT.
 public boolean after(Date date) 
    Returns if this {@code Date} is after the specified Date.
 public boolean before(Date date) 
    Returns if this {@code Date} is before the specified Date.
 public Object clone() 
    Returns a new {@code Date} with the same millisecond value as this {@code Date}.
 public int compareTo(Date date) 
    Compare the receiver to the specified {@code Date} to determine the relative ordering.
 public boolean equals(Object object) 
    Compares the specified object to this {@code Date} and returns if they are equal. To be equal, the object must be an instance of {@code Date} and have the same millisecond value.
 public int getDate() 
Deprecated! use - {@code Calendar.get(Calendar.DATE)}

    Returns the gregorian calendar day of the month for this {@code Date} object.
 public int getDay() 
Deprecated! use - {@code Calendar.get(Calendar.DAY_OF_WEEK)}

    Returns the gregorian calendar day of the week for this {@code Date} object.
 public int getHours() 
Deprecated! use - {@code Calendar.get(Calendar.HOUR_OF_DAY)}

    Returns the gregorian calendar hour of the day for this {@code Date} object.
 public int getMinutes() 
Deprecated! use - {@code Calendar.get(Calendar.MINUTE)}

    Returns the gregorian calendar minute of the hour for this {@code Date} object.
 public int getMonth() 
Deprecated! use - {@code Calendar.get(Calendar.MONTH)}

    Returns the gregorian calendar month for this {@code Date} object.
 public int getSeconds() 
Deprecated! use - {@code Calendar.get(Calendar.SECOND)}

    Returns the gregorian calendar second of the minute for this {@code Date} object.
 public long getTime() 
    Returns this {@code Date} as a millisecond value. The value is the number of milliseconds since Jan. 1, 1970, midnight GMT.
 public int getTimezoneOffset() 
Deprecated! use - {@code (Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / 60000}

    Returns the timezone offset in minutes of the default {@code TimeZone}.
 public int getYear() 
Deprecated! use - {@code Calendar.get(Calendar.YEAR) - 1900}

    Returns the gregorian calendar year since 1900 for this {@code Date} object.
 public int hashCode() 
    Returns an integer hash code for the receiver. Objects which are equal return the same value for this method.
 public static long parse(String string) 
Deprecated! use - DateFormat

    Returns the millisecond value of the date and time parsed from the specified {@code String}. Many date/time formats are recognized, including IETF standard syntax, i.e. Tue, 22 Jun 1999 12:16:00 GMT-0500
 public  void setDate(int day) 
Deprecated! use - {@code Calendar.set(Calendar.DATE, day)}

    Sets the gregorian calendar day of the month for this {@code Date} object.
 public  void setHours(int hour) 
Deprecated! use - {@code Calendar.set(Calendar.HOUR_OF_DAY, hour)}

    Sets the gregorian calendar hour of the day for this {@code Date} object.
 public  void setMinutes(int minute) 
Deprecated! use - {@code Calendar.set(Calendar.MINUTE, minute)}

    Sets the gregorian calendar minute of the hour for this {@code Date} object.
 public  void setMonth(int month) 
Deprecated! use - {@code Calendar.set(Calendar.MONTH, month)}

    Sets the gregorian calendar month for this {@code Date} object.
 public  void setSeconds(int second) 
Deprecated! use - {@code Calendar.set(Calendar.SECOND, second)}

    Sets the gregorian calendar second of the minute for this {@code Date} object.
 public  void setTime(long milliseconds) 
    Sets this {@code Date} to the specified millisecond value. The value is the number of milliseconds since Jan. 1, 1970 GMT.
 public  void setYear(int year) 
Deprecated! use - {@code Calendar.set(Calendar.YEAR, year + 1900)}

    Sets the gregorian calendar year since 1900 for this {@code Date} object.
 public String toGMTString() 
Deprecated! use - DateFormat

    Returns the string representation of this {@code Date} in GMT in the format: 22 Jun 1999 13:02:00 GMT
 public String toLocaleString() 
Deprecated! use - DateFormat

    Returns the string representation of this {@code Date} for the default {@code Locale}.
 public String toString() 
    Returns the string representation of this {@code Date} in the format: Tue Jun 22 13:07:00 GMT 1999