public static String getImageDateInDiary(String path) { String result = ""; try { ExifInterface exifInterface = new ExifInterface(path); result = exifInterface.getAttribute(ExifInterface.TAG_DATETIME); } catch (IOException e) { e.printStackTrace(); result = "日時不明"; } if (result != null) { result = result.substring(0, 4) + "/" + result.substring(5, 7) + "/" + result.substring(8, 10) + " " + result.substring(11, 13) + ":" + result.substring(14, 16); } else { result = "日時不明"; } return result; }
コメントを残す