Convert Timestamp to Date?

Поиск
Список
Период
Сортировка
Искать

Convert Timestamp to Date?

От:
"Dr. Evil" <drevil@sidereal.kz>
Дата:

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?

От:
Barry Lind <barry@xythos.com>
Дата:
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
> 
> 


FAQ