The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Portlet Dates

Highlighted
Karen Peiser
Acclaimed Contributor

Portlet Dates

How can I define a portlet column as a date and get it to display in any format besides m/d/yy? I'd like to get the date in the format of DD-MON-YYYY, but mm/dd/yyyy will be okay too. We need to be able to sort on the date. When I run my datasource query in Toad, the date is returned as mm/dd/yyyy, but in the portlet the date is displayed as m/d/yy. Any help is greatly appreciated.
4 REPLIES
Alexei Malinovs
Regular Collector

Re: Portlet Dates

Hi Karen,

Try this function as a field in SQL Data Source query:
to_char(date,'dd-mmm-yyyy')

So, it will look like:

select
to_char(date,'dd-mmm-yyyy') as date
from
some_table

OI have not tested this exact code but we use this approach to format the dates in a query. Please note that resulting field is not a date format but string format.
Karen Peiser
Acclaimed Contributor

Re: Portlet Dates

Thanks for your response. That is what I tried, but the problem with turning the date into a char string is that it is not a sortable date. Is sorts as a character string which is incorrect. Any other ideas are greatly appreciated.
StefanBienz
Super Collector

Re: Portlet Dates

Hi Karen,

Converting to string - as you noticed - isn't a solution, if you need to sort it.

The format of a date in a portlet is - as far as I know - determinated by the browser setting (Internet options->language) , so choose/add here a language which has the desired setting, like de-DE (German).

This is actually by design: each user should see the date format that he likes ;-)

Hope that helps,

Stefan Bienz
Cirrus Consulting AG
Jim Esler
Honored Contributor

Re: Portlet Dates

When we have a date column that we want to be able to sort, we convert it to a string value that gives a reasonable sort. We use yyyy/mm/dd. It is intuitive to most people even if it is not what they usually work with.
//Add this to "OnDomLoad" event