Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to change default date format for my application

Re: How to change default date format for my application

From: Jim Kennedy <>
Date: Sun, 26 Sep 2004 16:57:12 GMT
Message-ID: <IxC5d.265328$mD.221906@attbi_s02>

"Axel Seinsche" <> wrote in message news:4156f0e4$0$18967$
> Jim Kennedy schrieb:
> > "Axel Seinsche" <> wrote in message
> > news:4156cec2$0$25785$
> >
> >
> >
> > A better approach is to explicitly display the date as a string in the
> > query. select to_char(mydate,'mm/dd/yy hh24:mi:ss') from ...
> > Look up the valid date formats for how you want it displayed.
> > Jim
> >
> >
> This is exactly what I want to avoid! I have a JSP page where I want to
> format the date with fmt:formatDate. The same query should be used on
> different pages and on these pages the date should be formatted
> differently. This is why I wanted to avoid this. Now with the default
> settings only the date is well formatted and time is alway 00:00:00
> because it's not returned by Oracle - but is contained in the DB.
> Axel

What is happening is your jsp stuff is asking for the date as a string NOT as a date. If it handled it as a date and not a string then it wouldn't be a problem. A date and a string are very different things. When using other interfaces (eg oci ) the date comes across as a date or a binary structure that has all the date parts. I would look at mapping the date as a date and then in JSP formatting it as a string for display purposes. I don't know anything about fmt:formatDate. You would have to do a query in sqlplus to see if the date part has a time component, if on insert a time component isn't specified then you get midnight or 00:00:00. But retrieving the date as a date instead of a formatted string would help a lot. Jim Received on Sun Sep 26 2004 - 11:57:12 CDT

Original text of this message