Date


Date java.util

Java 1.0 cloneable serializable comparable

This class represents dates and times and lets you work with them in a system-independent way. You can create a Date by specifying the number of milliseconds from the epoch (midnight GMT, January 1st, 1970) or the year, month, date, and, optionally , the hour , minute, and second. Years are specified as the number of years since 1900. If you call the Date constructor with no arguments, the Date is initialized to the current time and date. The instance methods of the class allow you to get and set the various date and time fields, to compare dates and times, and to convert dates to and from string representations. As of Java 1.1, many of the date methods have been deprecated in favor of the methods of the Calendar class.

Figure 16-13. java.util.Date

 public class  Date  implements Serializable, Cloneable, Comparable<Date> {  // Public Constructors  public  Date  ( );        public  Date  (long  date  );  #  public  Date  (String  s  );  #  public  Date  (int  year  , int  month  , int  date  );  #  public  Date  (int  year  , int  month  , int  date  , int  hrs  , int  min  );  #  public  Date  (int  year  , int  month  , int  date  , int  hrs  , int  min  , int  sec  );  // Public Instance Methods  public boolean  after  (Date  when  );        public boolean  before  (Date  when  );        public long  getTime  ( );  default:1101702237486  public void  setTime  (long  time  );  // Methods Implementing Comparable   1.2  public int  compareTo  (Date  anotherDate  );  // Public Methods Overriding Object   1.2  public Object  clone  ( );        public boolean  equals  (Object  obj  );        public int  hashCode  ( );        public String  toString  ( );  // Deprecated Public Methods   #  public int  getDate  ( );  default:28   #  public int  getDay  ( );  default:0   #  public int  getHours  ( );  default:20   #  public int  getMinutes  ( );  default:23   #  public int  getMonth  ( );  default:10   #  public int  getSeconds  ( );  default:57   #  public int  getTimezoneOffset  ( );  default:480   #  public int  getYear  ( );  default:104   #  public static long  parse  (String  s  );  #  public void  setDate  (int  date  );  #  public void  setHours  (int  hours  );  #  public void  setMinutes  (int  minutes  );  #  public void  setMonth  (int  month  );  #  public void  setSeconds  (int  seconds  );  #  public void  setYear  (int  year  );  #  public String  toGMTString  ( );  #  public String  toLocaleString  ( );  #  public static long  UTC  (int  year  , int  month  , int  date  , int  hrs  , int  min  , int  sec  );   } 

Passed To

Too many methods to list.

Returned By

Too many methods to list.



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net