Adding a SimpleDateFormat to UTC Date in Kotlin
1 min readDec 14, 2019
Example: 2019–12–14T10:30:00Z
val dateFormat = SimpleDateFormat(“yyyy-MM-dd’T’HH:mm:ss”, Locale.getDefault())
val date =
dateFormat.parse(“2019–12–14T10:30:00Z”)
val formatter =
SimpleDateFormat(“yyyy-MM-dd”) //If you need time just put specific format for time like ‘HH:mm:ss’
val dateStr = formatter.format(date)
The output will be: 2019–12–14
Happy coding!