OK so I wrote a full text filter where I want to compare/check a Date field that has been indexed (and corresponds to a DATETIME field in a DB table).
I am having a problem however in my filter. Here is the code for that part:
Code:
int doc = termDocs.doc();
Document document = reader.document(doc);
String testValue = document.get(field);
the String testValue gets the DATETIME field but it contains strings in the following format:
Quote:
20100313020049000
20100313020052000
20100313020054000
20100313020056000
20100313020100000
20100313020102000
according to this
http://docs.huihoo.com/hibernate/annotations-reference-3.2.1/lucene.html "Dates are stored as yyyyMMddHHmmssSSS in GMT time (200611072203012 for Nov 7th of 2006 4:03PM and 12ms EST)", so I am guessing that is the reason for that.
MY problem is how can I get an actual Date object OR "long millisecond" variable from a String with format 20100313020049000 (convert from 20100313020049000 to Date or a millisecond timestamp? I've been trying to figure this out for a while now with no progress.
Please help!