plus
Returns an instant that is the result of adding the specified duration to this instant.
If the duration is positive, the returned instant is later than this instant. If the duration is negative, the returned instant is earlier than this instant.
The return value is clamped to the platform-specific boundaries for Instant if the result exceeds them.
Pitfall: Duration.Companion.days are multiples of 24 hours and are not calendar-based. Consider using the plus overload that accepts a multiple of a DateTimeUnit instead for calendar-based operations instead of using Duration. For an explanation of why some days are not 24 hours, see DateTimeUnit.DayBased.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
import kotlin.time.Duration.Companion.hours
fun main() {
//sampleStart
// Finding a moment that's later than the starting point by the given amount of real time
val instant = Instant.fromEpochSeconds(7 * 60 * 60, nanosecondAdjustment = 123_456_789)
val fiveHoursLater = instant + 5.hours
check(fiveHoursLater.epochSeconds == 12 * 60 * 60L)
check(fiveHoursLater.nanosecondsOfSecond == 123_456_789)
//sampleEnd
}