• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem printing a date from the database

 
Charles Diskin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello, I am having a problem printing a date in the MM/DD/YYYY format. It is an Access DB and inside the tables it is stored as: 03/16/2006 but when it is pulled out and printed on a web page it is displayed as: 2006-03-16. Here is the code-



I was wondering if anyone knows how I can get the orignal format (MM/DD/YYYY) to display.Thanks in advance
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Charles,
Instead of getting it as a String, get it as a Date using rs.getDate(). Then you can use SimpleDateFormatter to get any format you wish.

This also has the benefit of not being dependent on the driver/database.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic