Android Read Exif Date as LocalDateTime

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.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.