--

While this works, this is going to perform absolutely terribly if you use these extension functions in something like a recyclerview's binding.

SimpleDateFormat's constructor is a beast and attempting to reuse the resulting constructed object is also not thread safe.

SimpleDateFormat is an ancient Java API with a huge number of issues. I strongly recommend people use the more modern java 8 time APIs instead, or the Kotlin variants if that's your thing.

--

--

Michael Ferguson
Michael Ferguson

Written by Michael Ferguson

Android software developer. Views and opinions expressed are my own and not that of my employer.

No responses yet