Jump to content
We've recently updated our Privacy Statement, available here ×

Formating a date with pattern using oracle


Recommended Posts

By: Martin Phee - mphee

Formating a date with pattern using oracle

2002-11-04 06:47

I 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:05

I'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:04

I'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:06

I"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:13

I 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:30

How 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:05

Do 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:14

Thank you. It worked. Replaced the filed and textexpression with Timestamp.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...