I'm trying to format a date and then convert it to a local time , by upon trying it keeps throwing an exception that the data is unparsable , i have attached the code below , if anyone could help , Thank you
- Code that i'm using
fun test() : String {
val inputFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
Locale.US)
inputFormat.timeZone = TimeZone.getTimeZone("GMT")
val date = inputFormat.parse(input)
val outputFormat = SimpleDateFormat("MMM dd, yyyy hh:mma",
Locale.US)
outputFormat.timeZone = TimeZone.getDefault()
return outputFormat.format(date)
}