This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes f:convertDateTIme problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "f:convertDateTIme problem" Watch "f:convertDateTIme problem" New topic
Author

f:convertDateTIme problem

Dwijen Bhattacharjee
Greenhorn

Joined: Mar 31, 2008
Posts: 26
Hi,
I want a output like Monday,May19 2008so i use the following code

<hutputText value="#{testBean.date}" >
<f:convertDateTime type="date" dateStyle="full" />
</hutputText>

TestBean's getDate() returns new Date();
but i am getting a output like Mon May 19 19:05:47 IST 2008

how can i get the desired Output.
i also tried pattern of the <f:convetDateTime like pattern="EEEE, MMMM d, yyyy" but no luck.
please help.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962
    
  19

Try dateStyle="long". The formats are in the JavaDocs (http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html)


Customer surveys are for companies who didn't pay proper attention to begin with.
Dwijen Bhattacharjee
Greenhorn

Joined: Mar 31, 2008
Posts: 26
Hi,
According to the JavaDocs
* SHORT is completely numeric, such as 12.13.52 or 3:30pm
* MEDIUM is longer, such as Jan 12, 1952
* LONG is longer, such as January 12, 1952 or 3:30:32pm
* FULL is pretty completely specified, such as Tuesday, April 12,
1952 AD or 3:30:42pm PST

so I have used Full.
Now my question is---
Whatever I have done Is it enough or I am missing something to add
in the code?
because I am using type="date" but still I am getting the Time &
date (which is the output of new date()).so that means it is not
converting . Plese help ..
 
 
subject: f:convertDateTIme problem
 
Similar Threads
convertDateTime seconds???
Problem displaying desired output
date converter
how to diplay correct date & time ???
MyFaces-Date/TimeZone Issue?