KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > util > Date

java.util
Class Date

java.lang.Object
  extended by java.util.Date
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Date>
Direct Known Subclasses:
Date, Time, Timestamp
See Also:
Top Examples, Source Code, DateFormat, Calendar, TimeZone

public boolean after(Date when)
See Also:
NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[383]Check to see if any date is later than today
By Anonymous on 2005/07/14 08:26:14  Rate
//check to see if any date is later than today 
  
  
 SimpleDateFormat sdf = new SimpleDateFormat ( "MM/dd/yyyy" ) ; 
 java.util.Date aDate = sdf.format ( sdf.parse ( "07/08/2003" )  ) ; 
  
  
 if  ( !aDate.after ( sdf.format ( new Date (  )  )  )  )  
    return false; 
 


public boolean before(Date when)
See Also:
NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Object clone()
See Also:
Cloneable
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int compareTo(Object o)
See Also:
Comparable, ClassCastException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int compareTo(Date anotherDate)
See Also:
NullPointerException, Comparable, compareTo
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Date()
See Also:
System.currentTimeMillis()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Date(int year,
                       int month,
                       int date)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Date(int year,
                       int month,
                       int date,
                       int hrs,
                       int min)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Date(int year,
                       int month,
                       int date,
                       int hrs,
                       int min,
                       int sec)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public Date(String s)
See Also:
parse(java.lang.String), DateFormat
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Date(long date)
See Also:
System.currentTimeMillis()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean equals(Object obj)
See Also:
getTime()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public int getDate()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[184]Use GregorianCalendar to get today
By Anonymous on 2005/02/27 01:53:40  Rate
* Declare Variables 
      */ 
     Date start = null; // these Dates will be populated 
     Date end = null; // with values from the strings 
     long startTime = 0L; 
     long endTime = 0L; 
  
  
     SimpleDateFormat sdf = new SimpleDateFormat (  "MM/dd/yyyy HH:mm:ss"  ) ; 
  
  
     GregorianCalendar yCalendar = new GregorianCalendar (  ) ; 
     Date yTodaysDate = yCalendar.getTime (  ) ; 
  
  
     String yDay = ""; 
     yTodaysDate.getDate ( yDay ) ; 
 


@Deprecated
public int getDay()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public int getHours()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1166]Get hours
By mdsudha_21 on 2004/12/03 07:25:44  Rate
date.getHours (  ) 

@Deprecated
public int getMinutes()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public int getMonth()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public int getSeconds()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public long getTime()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[302]Get previous and next date
By Anonymous on 2003/07/08 17:40:41  Rate
private static final int MILLIS_IN_DAY = 1000 * 60 * 60 * 24; 
 public static Date getPreviousDate (  Date thisDay  )  
  {  
     return new Date (  thisDay.getTime (  )  - MILLIS_IN_DAY  ) ; 
  }  
  
  
 public static Date getNextDate (  Date thisDay  )  
  {  
     return new Date (  thisDay.getTime (  )  + MILLIS_IN_DAY  ) ; 
  }     


@Deprecated
public int getTimezoneOffset()
See Also:
TimeZone.getDefault(), Calendar.DST_OFFSET, Calendar.ZONE_OFFSET
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public int getYear()
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int hashCode()
See Also:
Hashtable, Object.equals(java.lang.Object), getTime()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public static long parse(String s)
See Also:
DateFormat, SimpleDateFormat
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void setDate(int date)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void setHours(int hours)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void setMinutes(int minutes)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void setMonth(int month)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void setSeconds(int seconds)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setTime(long time)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public void setYear(int year)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public String toGMTString()
See Also:
toLocaleString(), toString(), DateFormat
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public String toLocaleString()
See Also:
toGMTString(), toString(), DateFormat
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
toGMTString(), toLocaleString(), Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


@Deprecated
public static long UTC(int year,
                                  int month,
                                  int date,
                                  int hrs,
                                  int min,
                                  int sec)
See Also:
Calendar
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags