lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ype Kingma <ykin...@xs4all.nl>
Subject Re: A little date help
Date Wed, 20 Nov 2002 21:35:05 GMT
Rob,

On Wednesday 20 November 2002 21:20, you wrote:
> Hello all,
>
> I am indexing the date using the java.io.file.lastModified() method
>
> doc.add(new Field(MODIFIED_DT,
>             DateField.timeToString(f.lastModified()), true, true, true));
>
> I am trying to search on this field, but I am having a hard time formatting
> the date correctly.  I am not sure what date format lastModified() uses so
> trying to come up with a query in milliseconds for the above date field is
> difficult.
>
> Has anyone run into this problem?  Is there an easier way to do this?

In case you can do with less precision, you can store/index the date as a 
string of 8 digits yyyymmdd. There are some date formatting functions in 
java.text iirc. The format also nicely allows range queries.

Regards,
Ype

--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@jakarta.apache.org>


Mime
View raw message