Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can I suppress formatting in getDate()?

843859May 5 2006 — edited May 5 2006
I'm getting a "Date" by using the getDate() method. That's fine. What's not fine is that when I display the date on a web page (using c:out) I get a date with dashes in it. So instead of 20070601, I see "2007-06-01". That's problem because you can't go the other way. You have to stip out the dashes in order to create a GregorianCalendar in order to make a java.sql.Date to do an update to the row. I can strip them out at update time, but I'd like to know two things. First, do the dashes only show up when the java.sql.Date is printed, so that if I could look at its raw representation there wouldn't be dashes? Second, is there a way to suppress this "assistance" of putting in dashes when the java.sql.Date is displayed? If it is internally 20070601, I want it to display as "20070601" and never "2007-06-01". Can I do this when I first do a getDate()? Thanks.

Ken
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 2 2006
Added on May 5 2006
2 comments
28 views