val exif = ExifInterface(filePath)val date = exif.getAttribute(ExifInterface.TAG_DATETIME).let { value -> if (!value.isNullOrEmpty()) { // 2017:08:05 21:21:24 val formatter = DateTimeFormatter.ofPattern("yyyy:MM:dd HH:mm:ss") LocalDateTime.parse(value, formatter) } else { null }}
NOTE: Sadly there is no way to get timezone from EXIF data.