> 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()
>               );
>       }
>

Reply via email to