java.sql
Class Timestamp
- Cloneable, Comparable<T>, Serializable
This class is a wrapper around java.util.Date to allow the JDBC
driver to identify the value as a SQL Timestamp. Note that this
class also adds an additional field for nano-seconds, and so
is not completely identical to java.util.Date
as
the java.sql.Date
and java.sql.Time
classes are.
Timestamp(int year, int month, int day, int hour, int minute, int second, int nanos)
|
Timestamp(long date) - This method initializes a new instance of this class with the
specified time value representing the number of milliseconds since
Jan 1, 1970 at 12:00 midnight GMT.
|
boolean | after(Timestamp ts) - This methods tests whether this object is later than the specified
object.
|
boolean | before(Timestamp ts) - This methods tests whether this object is earlier than the specified
object.
|
int | compareTo(Timestamp ts) - Compares this
Timestamp to another one.
|
int | compareTo(Date obj) - Compares this
Timestamp to another one.
|
boolean | equals(Object obj) - This method these the specified
Object for equality
against this object.
|
boolean | equals(Timestamp ts) - This method tests the specified timestamp for equality against this
object.
|
int | getNanos() - This method returns the nanosecond value for this object.
|
long | getTime() - Return the value of this Timestamp as the number of milliseconds
since Jan 1, 1970 at 12:00 midnight GMT.
|
void | setNanos(int nanos) - This method sets the nanosecond value for this object.
|
String | toString() - This method returns this date in JDBC format.
|
static Timestamp | valueOf(String str) - This method returns a new instance of this class by parsing a
date in JDBC format into a Java date.
|
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 |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
Timestamp
public Timestamp(int year,
int month,
int day,
int hour,
int minute,
int second,
int nanos)
This method initializes a new instance of this class with the
specified year, month, and day.
year
- The year for this Timestamp (year - 1900)month
- The month for this Timestamp (0-11)day
- The day for this Timestamp (1-31)hour
- The hour for this Timestamp (0-23)minute
- The minute for this Timestamp (0-59)second
- The second for this Timestamp (0-59)nanos
- The nanosecond value for this Timestamp (0 to 999,999,9999)
Timestamp
public Timestamp(long date)
This method initializes a new instance of this class with the
specified time value representing the number of milliseconds since
Jan 1, 1970 at 12:00 midnight GMT.
date
- The time value to intialize this Time
to.
after
public boolean after(Timestamp ts)
This methods tests whether this object is later than the specified
object.
ts
- The other Timestamp
to test against.
true
if this object is later than the other object,
false
otherwise.
before
public boolean before(Timestamp ts)
This methods tests whether this object is earlier than the specified
object.
ts
- The other Timestamp
to test against.
true
if this object is earlier than the other object,
false
otherwise.
compareTo
public int compareTo(Timestamp ts)
Compares this Timestamp
to another one.
ts
- The other Timestamp.
0
, if both Timestamp
's represent exactly
the same date, a negative value if this Timestamp
is
before the specified Timestamp
and a positive value
otherwise.
compareTo
public int compareTo(Date obj)
Compares this Timestamp
to another one. This behaves like
compareTo(Timestamp)
, but it may throw a
ClassCastException
, if the specified object is not of type
Timestamp
.
- compareTo in interface Date
obj
- The object to compare with.
0
, if both Timestamp
's represent exactly
the same date, a negative value if this Timestamp
is
before the specified Timestamp
and a positive value
otherwise.
equals
public boolean equals(Object obj)
This method these the specified Object
for equality
against this object. This will be true if an only if the specified
object is an instance of Timestamp
and has the same
time value fields.
- equals in interface Date
obj
- The object to test against for equality.
true
if the specified object is equal to this
object, false
otherwise.
equals
public boolean equals(Timestamp ts)
This method tests the specified timestamp for equality against this
object. This will be true if and only if the specified object is
not null
and contains all the same time value fields
as this object.
ts
- The Timestamp
to test against for equality.
true
if the specified object is equal to this
object, false
otherwise.
getNanos
public int getNanos()
This method returns the nanosecond value for this object.
- The nanosecond value for this object.
getTime
public long getTime()
Return the value of this Timestamp as the number of milliseconds
since Jan 1, 1970 at 12:00 midnight GMT.
- getTime in interface Date
setNanos
public void setNanos(int nanos)
This method sets the nanosecond value for this object.
nanos
- The nanosecond value for this object.
valueOf
public static Timestamp valueOf(String str)
This method returns a new instance of this class by parsing a
date in JDBC format into a Java date.
str
- The string to parse.
- The resulting
java.sql.Timestamp
value.
Time.java -- Wrapper around java.util.Date
Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.