added DateModified

This commit is contained in:
Hendrik Schutter 2019-02-22 13:36:51 +01:00
parent 0d4c2825f6
commit d0f3933574
2 changed files with 29 additions and 1 deletions

25
src/DateModified.java Normal file
View File

@ -0,0 +1,25 @@
import java.io.File;
import java.util.Calendar;
import java.util.Date;
public class DateModified
{
public Calendar getDate(String filepath)
{
Calendar calendar = Calendar.getInstance();
// Specify the file path and name
File file = new File(filepath);
long lastModified = file.lastModified();
Date date = new Date(lastModified);
System.out.println(date);
calendar.setTime(date);
return calendar;
}
}

View File

@ -102,6 +102,7 @@ public class Main
DBController db = new DBController(projectPath);
Exif exif = new Exif();
DateModified datemod = new DateModified();
db.connectDatabase();
db.createTableImages();
@ -140,7 +141,9 @@ public class Main
// gefunden
File f = new File(rootFolderPath + path);
int size = (int) f.length();
Calendar calendar = exif.getDate(rootFolderPath + path);
// Calendar calendar = exif.getDate(rootFolderPath + path);
Calendar calendar = datemod.getDate(rootFolderPath + path);
db.fillImages(i, path, calendar.get(Calendar.DAY_OF_MONTH),
(calendar.get(Calendar.MONTH) + 1),