In this section, you will study how to obtain the file timestamp.
The following example shows the modification date and time of the specified file. The class Runtime provides the runtime environment. The class BufferedReader reads the file from the console and the method runtime.exec("cmd/c dir" +fname) executes the process. We have create another instance of class BufferedReader to get output from process.
Here is the code of GetFileTimestamp.java
import java.io.*; |
Output will be displayed as:

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java get File Timestamp View All Comments
Post your Comment