2001 JI Open Discussion Posted August 17, 2006 Share Posted August 17, 2006 By: Martin Phee - mphee Formating a date with pattern using oracle 2002-11-04 06:47I have two Oracle date fields. Open_date, close_date. If I use a pattern of "MM/dd/yyyy" it works fine, but when I add HH:mm:ss I'm not getting the the time. I worked around by doing a to_char on the field and putting it into the format I want. I tried to do not pattern and all I got was '2002-11-02'. pattern="MM/dd/yyyy HH:mm:ss" isn't working. By: J rgen Lundberg - jorgen99 RE: Formating a date with pattern using oracl 2002-11-04 07:05I'm not sure if I'm correct on this one, but I dont think that java.sql.Date has a time component. Check out the JavaDocs: http://java.sun.com/j2se/1.4.1/docs/api/java/sql/Date.html / J rgen By: J rgen Lundberg - jorgen99 RE: Formating a date with pattern using oracl 2002-11-04 07:04I'm not sure if I'm correct on this one, but I dont think that java.sql.Date has a time component. Check out the JavaDocs: http://java.sun.com/j2se/1.4.1/docs/api/java/sql/Date.html / J rgen By: Martin Phee - mphee RE: Formating a date with pattern using oracl 2002-11-04 07:06I"m using java.lang.Date. That is what jasper supports. By: J rgen Lundberg - jorgen99 RE: Formating a date with pattern using oracl 2002-11-04 07:13I havn't checked, but if Jasper converts the sql.Date to a util.Date the time should be lost since sql.Date's time is 00:00:00. Again, I'm making a qualified guess here... :) / J rgen By: Martin Phee - mphee RE: Formating a date with pattern using oracl 2002-11-04 07:30How am I supposed to get the time then? By: J rgen Lundberg - jorgen99 RE: Formating a date with pattern using oracl 2002-11-04 08:05Do you have the date as a java.sql.Date or a java.sql.Timestamp? If you have a Timestamp then you should be able to get the time as well as the date. Both sql.Date and sql.Timestamp extends util.Date but only Timestamp has both date and time. By: Martin Phee - mphee RE: Formating a date with pattern using oracl 2002-11-04 08:14Thank you. It worked. Replaced the filed and textexpression with Timestamp. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now