directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <seelm...@apache.org>
Subject Re: [SHARED-LDAP] new methods in DateUtils class
Date Sat, 08 Nov 2008 21:38:59 GMT
Hi Kiran,

sure, you could add these convenient methods.

However be aware of the missing time zone information. Date objects and
timestamps don't contain any time zone information while the generalized
time does. The DateUtils class always assumes 'Z' time zone.

For that reason I created a GeneralizedTime class that is based on
java.util.Calendar.

Kind Regards,
Stefan Seelmann



Kiran Ayyagari wrote:
> hi guys,
> 
>    I want to add two new methods to DateUtils class for getting the
> generalized
>    time string in a convenient way when providing a Date object or time
> as a
>    long value
> 
>    waiting for your view(s) before committing it
> 
>    they look like below mentioned code
> 
>     /**
>      *
>      * @see #getGeneralizedTime()
>      *
>      * @param date the date to be converted to generalized time string
>      * @return given date in the generalized time string format
>      */
>     public static String getGeneralizedTime( Date date )
>     {
>         synchronized ( dateFormat )
>         {
>             return dateFormat.format( date );
>         }
>     }
> 
> 
>     /**
>      *
>      * @see #getGeneralizedTime()
>      *
>      * @param time the time value to be converted to generalized time
> string
>      * @return given time in generalized time string format
>      */
>     public static String getGeneralizedTime( long time )
>     {
>         return getGeneralizedTime( new Date( time ) );
>     }
> 


Mime
View raw message