I would like to extract the date a jpg file was created. Java has the lastModified method for the File object, but appears to provide no support for extracting the created date from the file. I believe the information is stored within the file as the date I see when I hover the mouse pointer over the file in Win XP is different than what I can get by using JNI with "dir /TC" on the file in DOS.
The method creationTime() returns creation date of file as FileTime. This time, if the file system doesn't store the date of creating a file, then the method will return last modified date. If the last modified date is not stored as well, then the epoch (01.01. 1970) will be returned.
The lastModified() method of the File class returns the last modified time of the file/directory represented by the current File object. You can get the last modified time of a particular file using this method.
The information is stored within the image in a format called EXIF or link text. There several libraries out there capable of reading this format, like this one
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