tag <p:calendar whit <f:convertDateTime

UI Components for JSF
Post Reply
bruno.vandrade
Posts: 1
Joined: 18 Jul 2011, 16:40

18 Jul 2011, 17:23

<p:calendar/> this by setting the tag value null when use locale = "pt_BR" and <f:convertDateTime/> tag also does not convert the data into the desired format. In addition, the pattern attribute does not work. I tested the managed bean with three types of attributes: date, timestamp and string, and the format that the arrow is always like this: Sat Jul 23 00:00:00 BRT 2011. I use primefaces-2.2.1.jar .Below is snippet of code:

Code: Select all

<p:calendar value="#{comissao.data3}" pattern="dd.MM.yyyy" locale="pt_BR" >
				<f:convertDateTime pattern="yyyy-MM-dd" />
			</p:calendar>


Andre Froes
Posts: 155
Joined: 16 Mar 2011, 17:24
Location: Brazil - Curitiba

18 Jul 2011, 17:55

Yo Bruno, what are you trying to do? when you set your tag p:calendar, you wont need the f:convertDateTime.
There are 2 situations here:
Judging that we are country mates, the brazilian regular time and date is dd/MM/yyyy, so throw this in the calendar pattern, the atribute locale="pt_BR" wont even be needed;

Code: Select all

<p:calendar value="#{comissao.data3}" pattern="dd/MM/yyyy"/>
now, setting the convertDateTime we can do this:

Code: Select all

<h:outputText value="#{comissao.data3}">
    <f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText/>
this will set the outputText value to the current patter that you want.
if you are looking to add a date in your database with the p:calendar, set it into a Date variable that it will handle everything natively.

if you'd need any other help, my GUJ id is andre.froes

flw
PrimeFaces 3.5 | Glassfish 3.1 | Mojarra 2.1.5 (JSF 2.1)
Netbeans 7.2.1 | JDK1.7 | Java EE 6 | SQL Server 2008
Win7 64 bits | Firefox 10 - Chrome - IE (all unfortunately)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 25 guests