Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datatype in java to hold a timestamp or date value from database

 
kapil gureja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I have a time-stamp value stored in database. Now, I used getTimestamp method on resultset to get the value. But the problem which i am facing here is which datatype is used to hold the value returned by getTimestamp method. Same problem with getDate....
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The data type to hold the value returned by the getTimestamp() method is java.sql.Timestamp. Likewise the data type to hold the value returned by the getDate() method is java.sql.Date.

You can tell this is the case by looking at the API documentation for ResultSet, where it explicitly says that getTimestamp() returns a java.sql.Timestamp object and so on.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic