webtier@glassfish.java.net

ConvertDateTime: one day deleted in view forms

From: <webtier_at_javadesktop.org>
Date: Thu, 25 Sep 2008 05:50:01 PDT

Hye,
I found an error which i can't resolve.
In my class, i have one date in a class:
public Class myClass{

java.util.Date myDate;

public java.util.Date getMyDate()
    {
         return this.myDate;
    }

public String getmyDateAsString() {
        SimpleDateFormat formatAMJ = new SimpleDateFormat("dd/MM/yyyy");
        String oneDate = formatAMJ.format(this.getMyDate());
        return oneDate;
    }
...

}
in my view form, if i use:
<h:outputText value="#{fmyFormPojo.myEntity.myDate}">
    <f:convertDateTime pattern="dd.MM.yyyy" />
 </h:outputText>
the day viewed is the real myDate value, with one day deleted.

if i use only
<h:outputText value="#{fmyFormPojo.myEntity.myDate}"> or
<h:outputText value="#{fmyFormPojo.myEntity.myDateAsString}">
the date viewed is the real value of myDate

for example:
in the Database, myDate is 25/09/2008.
with the use of convertDateTime, the date is 24/09/2008
without convertDateTime, the date is : 25 sept. 2008
with the use of getMyDateAsString methode, the Date value rendered is correct.

Could someone tell me where could be the mistake? i tried Locale, i inverted day and month in convertDateTime call without result.

Thanks in advance.
[Message sent by forum member 'machibat' (machibat)]

http://forums.java.net/jive/thread.jspa?messageID=301562