• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting time with milliseconds in ResultSet

 
Eduardo Pinhata
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a simple DB in MySQL



I'm trying to get the time with milliseconds using ResultSet and getTime() but I just get seconds with it. How can I also retrieve the milliseconds?

 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You define a "date" column and using getTime method?

Try the getTimestamp method and probably align the data type to Timestamp (if it's a data type in MySQL, can't recall)
 
Eduardo Pinhata
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you were right, I was supposed to change some of my code to use timestamp and it worked.
Next time I'll design my programs to use Timestamp from the beginning.

Thank you
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another possibility: using a BIGINT column and use System.currentTimeMillis() as a value
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic