if you use the s:convertDateTime converter, you're fine.

regards,

Martin

On 3/21/06, Frank Felix Debatin <[EMAIL PROTECTED]> wrote:
> Hi Matthias,
>
> actually I'm using the ADF calendar component - in the way described below,
>
> The calendar class picks up the CET locale ... but I'm not sure how and why.
>
>
> Frank Felix
>
>         <af:selectInputDate
>                 label="#{bundle['...']}"
>               value="#{bean.date}"
>                 chooseId="validFrom" required="true">
>                 <af:convertDateTime/>
>         </af:selectInputDate>
>
> class Bean
> {
>         Calendar myDate = ...
>
>         public Date getDate()
>         {
>                 return toNormalizedDate(myDate);
>         }
>
>         public void setDate(Date date)
>         {
>                 myDate = fromNormalizedDate(date);
>         }
> }
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 21, 2006 6:16 PM
> To: MyFaces Discussion
> Subject: AW: inputCalendar problem
>
>
> > Hi Matthias,
> >
> > I use the methods below to convert back and forth.
> >
> > Because our app uses java.util.Calendar, the method "toNormalizedDate"
> > is used to convert the calendar to a date suitable for JSF, and
> > "fromNormalizedDate" to convert it back.
>
> Many thanks. So you don't use the convertDateTime action at all? And how do
> I switch to using the Europe/Berlin TimeZone?
>
> -Matthias
>
>
> > Frank Felix
> >
> >       /**
> >        * Required to work around a bug in ADF/JSF, where
> >        * dates are always normalized to GMT, and then time
> >        * is set to 0, resulting in a change of date for all
> >        * time zones before GMT.
> >        *
> >        * @param calendar
> >        * @return normalized date
> >        */
> >       @SuppressWarnings("deprecation")
> >       public static Date toNormalizedDate(Calendar calendar)
> >       {
> >               return calendar==null ? null : new Date(
> >                       Date.UTC(
> >                               calendar.get(Calendar.YEAR)-1900,
> >                               calendar.get(Calendar.MONTH),
> >                               calendar.get(Calendar.DATE),
> >                               0,
> >                               0,
> >                               0
> >                       )
> >               );
> >       }
> >
> >       /**
> >        * Required to work around a bug in ADF/JSF, where
> >        * dates are always normalized to GMT, and then time
> >        * is set to 0, resulting in a change of date for all
> >        * time zones before GMT.
> >        *
> >        * @param date the date to copy from
> >        */
> >       @SuppressWarnings("deprecation")
> >       public static Calendar fromNormalizedDate(Date date)
> >       {
> >               if (date==null)
> >               {
> >                       return null;
> >               }
> >               return new GregorianCalendar(
> >                       date.getDate(),
> >                       date.getYear()+1900),
> >                       date.getMonth()
> >               );
> >       }
> >
>
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to