From dev-return-27934-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Sat Nov 08 21:39:22 2008 Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 37888 invoked from network); 8 Nov 2008 21:39:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2008 21:39:22 -0000 Received: (qmail 39263 invoked by uid 500); 8 Nov 2008 21:39:29 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 39231 invoked by uid 500); 8 Nov 2008 21:39:29 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 39220 invoked by uid 99); 8 Nov 2008 21:39:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Nov 2008 13:39:29 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 08 Nov 2008 21:38:18 +0000 Received: (qmail 37651 invoked from network); 8 Nov 2008 21:39:01 -0000 Received: from localhost (HELO ?127.0.0.1?) (127.0.0.1) by localhost with SMTP; 8 Nov 2008 21:39:01 -0000 Message-ID: <491606F3.1090802@apache.org> Date: Sat, 08 Nov 2008 22:38:59 +0100 From: Stefan Seelmann User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: Apache Directory Developers List Subject: Re: [SHARED-LDAP] new methods in DateUtils class References: <4915EAEC.2010502@gmail.com> In-Reply-To: <4915EAEC.2010502@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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 ) ); > } >