I want to subtract the last modified date of a file to the current date. Is there a proper way that I can use in java? My problem is I don't know how to do it.
Asked
Active
Viewed 266 times
-6
-
2Have you bothered to Google this? – tnw Mar 08 '17 at 15:51
-
Did you do anything yourself? Like: trying? – f1sh Mar 08 '17 at 15:51
-
Java Date/Time tutorial - http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html – Subhrajyoti Majumder Mar 08 '17 at 15:51
-
I,m trying to subtract LastModifiedDate which is a string to a Date object which is Date dateobj = new Date(); what can i do to subtract a string to a Long value? – Atom Pastor Mar 08 '17 at 16:18
-
Problem Solve. I follow this thread http://stackoverflow.com/questions/13037654/subtract-two-dates-in-java thanks for the help guys... – Atom Pastor Mar 08 '17 at 19:07
-
@tnw The original purpose of Stack Overflow was to be the top results in a Google search. So googling other domains is *not* a requirement to using Stack Overflow. But searching for duplicates *within* Stack Overflow is expected, and posting without bothering to search first certainly is rude. – Basil Bourque Mar 10 '17 at 03:28
1 Answers
0
File file = new File("c:\\logfile.log");
System.out.println("Before Format : " + file.lastModified());
https://www.mkyong.com/java/how-to-get-the-file-last-modified-date-in-java/

NikNik
- 2,191
- 2
- 15
- 34