Thread: Convert Timestamp to Date?

Convert Timestamp to Date?

From
"Dr. Evil"
Date:
Hi, is there a way to convert java.sql.Timestamp to java.util.Date
type?  It seems like there should be because Timestamp is basically a
wrapper for Date, but there doesn't seem to be any method to do this.
I could have Timestamp output a string and then have Date parse the
string, but that seems very inefficient.

Thanks

Re: Convert Timestamp to Date?

From
Barry Lind
Date:
There is not need to convert these two datatypes.  Timestamp is a
subclass of Date.  Thus in the OO sense a Timestamp object is a Date
object.  You can just cast a Timestamp object to a Date.

thanks,
--Barry

Dr. Evil wrote:

> Hi, is there a way to convert java.sql.Timestamp to java.util.Date
> type?  It seems like there should be because Timestamp is basically a
> wrapper for Date, but there doesn't seem to be any method to do this.
> I could have Timestamp output a string and then have Date parse the
> string, but that seems very inefficient.
>
> Thanks
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>