|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.index.document.DateFieldTools
public class DateFieldTools
Provides support for converting dates to strings and vice-versa using seconds as the default time
granularity. 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 simply wraps the appropriate methods
from DateTools
and applies a resolution of seconds.
DateTools
Constructor Summary | |
---|---|
DateFieldTools()
|
Method Summary | |
---|---|
static String |
dateToString(Date date)
Converts a Date to a string suitable for indexing using resolution to seconds. |
static Date |
stringToDate(String dateString)
Converts a string produced by timeToString(long) or dateToString(java.util.Date) back to a time, represented
as a Date object. |
static long |
stringToTime(String dateString)
Converts a string produced by timeToString(long) or dateToString(java.util.Date) back to a time, represented
as the number of milliseconds since January 1, 1970, 00:00:00 GMT. |
static String |
timeToString(long time)
Converts a millisecond time to a string suitable for indexing using resolution to seconds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DateFieldTools()
Method Detail |
---|
public static final String dateToString(Date date)
date
- The Date
public static final String timeToString(long time)
time
- Time in millisonds
public static final Date stringToDate(String dateString) throws ParseException
timeToString(long)
or dateToString(java.util.Date)
back to a time, represented
as a Date object. Is also able to parse dates encoded in the old Lucene 1.x DateField format, for
compatibility with old indexes (this functionality will go away in a future release).
dateString
- A string produced by timeToString or dateToString
ParseException
- If parse errorpublic static final long stringToTime(String dateString) throws ParseException
timeToString(long)
or dateToString(java.util.Date)
back to a time, represented
as the number of milliseconds since January 1, 1970, 00:00:00 GMT. Is also able to parse dates encoded in
the old Lucene 1.x DateField format, for compatibility with old indexes (this functionality will go away
in a future release).
dateString
- A string produced by timeToString or dateToString
ParseException
- If parse error
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |