This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • 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: 34178
340
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