File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date or Timestamp?

 
Davie Lin
Ranch Hand
Posts: 294
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table column that stores Date in default format 'dd-MON-yy'
I use JDBC to retrieve this column but I need it to display hour and minute and am/pm for my struts 2 app.

I am wondering if I should change the column to Timestamp instead of Date, does Timestamp record more info down to hour and minute compare to Date type?

Thanks in advance
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33671
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Davie,
You are correct. Timestamp stores both date and time in a database. Date stores just date.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic