I'm writing a "Feed of posts" application on Kotlin. I faced with such a problem: The server sends the date and time of the post creation in such a format:
"2022-07-13T07:58:57.835201Z"
But I need something like this:
"13.07.2022 07:58"
I've tried something like this:
val pattern = "dd-MM-yyyy"
val simpleDateFormat = SimpleDateFormat(pattern)
val newDate = simpleDateFormat.format("2022-07-13T07:58:57.835201Z")
But when I do so, I get java.lang.IllegalArgumentException.
Can you please tell me how can I get the desired result?