Next Month

Report a typo

The function nextMonth(date: String): String takes an ISO 8601 date and time string (e.g., 2022-02-01T22:10:00Z) as a parameter and returns an ISO 8601 date and time string of the following month.

Write the correct code for the nextMonth() function.

This task uses dependencies that may not be available in your local IDE. As a result, you may see compilation errors or unresolved references when running the code locally. This does not affect solution validation when you submit your solution to Hyperskill.

Sample Input 1:

2000-12-01T00:00:00Z

Sample Output 1:

2001-01-01T00:00:00Z
Write a program in Kotlin
import kotlinx.datetime.*
import kotlin.time.Instant

fun nextMonth(date: String): String {
// Write your code here

//
}

fun main() {
val date = readln()
println(nextMonth(date))
}

Create a free account to access the full topic