开发者

Java to Oracle - Correct date format to use

开发者 https://www.devze.com 2023-03-04 17:44 出处:网络
We have a Java webapp that talks to an Oracle database. We are keeping track of a particular time (timestamp format in Oracle) and we were wondering what would be the best time format in java to use.

We have a Java webapp that talks to an Oracle database. We are keeping track of a particular time (timestamp format in Oracle) and we were wondering what would be the best time format in java to use.

The da开发者_JAVA百科tabase we are talking to could be in the US or Europe so we need a java type that will allow us to use Locales.

What in peoples opinion would be the best Java type to use?


You should use java.sql.Timestamp together with a PreparedStatement then you don't need to worry about a "format" at all.


What is the datatype of the Oracle field that you are storing timestamp?

Make sure it preserves timezone data.

0

精彩评论

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