How do I convert File#lastModified()
to a real date? The format is not really important.
You can simply use the fromtimestamp function from the DateTime module to get a date from a UNIX timestamp. This function takes the timestamp as input and returns the corresponding DateTime object to timestamp.
Right-click on the toolbar and select "customize". Then go to File 1 -> and check the "RAHS attributes/timestamp" box and push OK. You'll now have that "RAHS" button on the toolbar. You can then select the folder where the files are that you've rotated and which have thus had their "date modified" values changed.
To change the creation date on Word document settings, select the "File Properties" tab and check the box next to Modify File Date and Time Stamps. The dates are located below, and you can manually change the creation date and, if desired, the date and times of edits and modifications.
If you want to change the last modified date or change the file creation data, press to enable the Modify date and time stamps checkbox. This will enable you to change the created, modified, and accessed timestamps—change these using the options provided.
Date d = new Date(file.lastModified());
lastModified()
returns the milliseconds since 1970-01-01, and the Date
class stores its time also in the same way. The Date(long)
constructor takes these milliseconds, and initializes the Date
with it.
Just you use the SimpleDateFormat
class to convert long to date. Only you execute code:
new SimpleDateFormat("dd-MM-yyyy HH-mm-ss").format( new Date(new File(filename).lastModified()) );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With