public class DateFieldTools
extends java.lang.Object
DateTools
and applies a resolution of seconds.DateTools
Constructor and Description |
---|
DateFieldTools() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
dateToString(java.util.Date date)
Converts a Date to a string suitable for indexing using resolution to seconds.
|
static java.util.Date |
stringToDate(java.lang.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(java.lang.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 java.lang.String |
timeToString(long time)
Converts a millisecond time to a string suitable for indexing using resolution to seconds.
|
public static final java.lang.String dateToString(java.util.Date date)
date
- The Datepublic static final java.lang.String timeToString(long time)
time
- Time in millisondspublic static final java.util.Date stringToDate(java.lang.String dateString) throws java.text.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 dateToStringjava.text.ParseException
- If parse errorpublic static final long stringToTime(java.lang.String dateString) throws java.text.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 dateToStringjava.text.ParseException
- If parse error