Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get date picture created in java

Tags:

java

date

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.

like image 370
user16029 Avatar asked Sep 17 '08 14:09

user16029


People also ask

How to get file creation date and time in Java?

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.

How to get date from file in Java?

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.


1 Answers

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

like image 66
amo-ej1 Avatar answered Sep 25 '22 00:09

amo-ej1