开发者

How to change long variable to Timestamp in java?

开发者 https://www.devze.com 2023-03-04 08:46 出处:网络
Do you know how to change a long variable to Timestamp variable ? I can convert it开发者_高级运维 to a String but I need to convert it to Timestamp in order to use it in the database.Probably somethin

Do you know how to change a long variable to Timestamp variable ? I can convert it开发者_高级运维 to a String but I need to convert it to Timestamp in order to use it in the database.


Probably something like (assuming millis is your long variable, and represents milliseconds):

Timestamp ts = new Timestamp(millis)

http://download.oracle.com/javase/1.4.2/docs/api/java/sql/Timestamp.html

This question is better suited for stackoverflow though, I'm flagging it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号