core / io.islandtime / DateTime / copy

copy

(iosArm64, iosX64, jvm, macosX64) fun copy(date: Date = this.date, time: Time = this.time): DateTime
fun copy(year: Int = this.year, dayOfYear: Int = this.dayOfYear, hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond): DateTime
fun copy(year: Int = this.year, month: Month = this.month, dayOfMonth: Int = this.dayOfMonth, hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond): DateTime
fun copy(year: Int = this.year, monthNumber: Int, dayOfMonth: Int = this.dayOfMonth, hour: Int = this.hour, minute: Int = this.minute, second: Int = this.second, nanosecond: Int = this.nanosecond): DateTime

Return a copy of this DateTime, replacing individual components with new values as desired.

Exceptions

DateTimeException - if the resulting date-time is invalid