lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Snyder" <wsnyd...@gmail.com>
Subject Re: DateTools question
Date Thu, 27 Apr 2006 02:16:12 GMT
Makes sense. Thanks for the response!

--Bill

On 4/26/06, Chris Hostetter <hossman_lucene@fucit.org> wrote:
>
>
> : Why does DateTools.dateToString() return a String representation of my
> Date,
> : but in a different TimeZone. Does it use its own Calendar/TimeZone
> settings?
>
> Yes, DateTime is hardcoded to use GMT for it's string representations.
>
> It wouldn't be safe for DateTools to use your current TimeZone/Locale,
> because once you've indexed the value, your index might be used by another
> application (or another instance of your application) running in a
> differnet locale.
>
> The important thing is not what string DateTools.dateToString returns,
> it's whether you get an equivilent date back (based on the resolution you
> specified)) when you do something like this...
>
>   Date a = ...;
>   DateTools.Resolution r = ...;
>   Date b = DateTools.stringToDate(DateTools.dateToString(a,r));
>   System.out.println("Is '"+a+"' the same as '"+b+"' with "+r+"
> resolution?");
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message