Conversion of LastModified method
-
Hallo, I have a problem I use Lucene.Net and the method of IndexReader LastModified returns long, which means the number of seconds from Jan. 1, 1970(or another year, I am not so sure). I know there is a function for the conversion, but just do not know which one. Does anyone here have any idea? Here is the signature of the above-mentioned method: public static long LastModified(string directory) Thanks in advance! Amatisa
-
Hallo, I have a problem I use Lucene.Net and the method of IndexReader LastModified returns long, which means the number of seconds from Jan. 1, 1970(or another year, I am not so sure). I know there is a function for the conversion, but just do not know which one. Does anyone here have any idea? Here is the signature of the above-mentioned method: public static long LastModified(string directory) Thanks in advance! Amatisa
-
If the return value is a long, then it's probably the date value in ticks. You can convert it to a DateTime object via: DateTime dt = new DateTime(LastModified(directory));
Thank you very much. I have found the solution, but a bit different to your suggestions. I have just tried your suggestion but it didn't work. The problem lies in the returned value LastModified from IndexReader of Lucene.Net, which is the number of millisenconds from 1970.01.01.