we have something like ``` @Throws(ParseException:...
# android
d
we have something like
Copy code
@Throws(ParseException::class)
fun parseIso8601(input: String): Date {
  val format = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
  val withZone = input.replace("Z", "+00:00")
  try {
    val isoDateTime = "${withZone.substring(0..22)}${withZone.substring(23)}"
    return format.parse(isoDateTime)
  } catch (e: IndexOutOfBoundsException) {
    throw ParseException("Invalid length", 0)
  }
}