DateTools
Provides support for converting dates to strings and vice-versa. The strings are structured so that lexicographic sorting orders them by date, which makes them suitable for use as field values and search terms.
This class also helps you to limit the resolution of your dates. Do not save dates with a finer resolution than you really need, as then TermRangeQuery and PrefixQuery will require more memory and become slower.
Another approach is LongPoint, which indexes the values in sorted order. For indexing a Date or Calendar, just get the unix timestamp as long using Date.getTime or Calendar.getTimeInMillis and index this as a numeric value with [ ] and use org.gnit.lucenekmp.search.PointRangeQuery to query it.
Functions
Converts a Date to a string suitable for indexing.
Limit a date's resolution. For example, the date 1095767411000 (which represents 2004-09-21 13:50:11) will be changed to 1093989600000 (2004-09-01 00:00:00) when using Resolution.MONTH.
Limit a date's resolution. For example, the date 2004-09-21 13:50:11 will be changed to 2004-09-01 00:00:00 when using Resolution.MONTH.
Converts a string produced by timeToString or dateToString back to a time, represented as a Date object.
Converts a string produced by timeToString or dateToString back to a time, represented as the number of milliseconds since January 1, 1970, 00:00:00 GMT.
Converts a millisecond time to a string suitable for indexing.