Damien
Damien

Reputation: 4121

Java to Oracle - Correct date format 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 database 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?

Upvotes: 1

Views: 974

Answers (2)

Olaf
Olaf

Reputation: 6289

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

Make sure it preserves timezone data.

Upvotes: 2

user330315
user330315

Reputation:

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

Upvotes: 7

Related Questions