I am new to Kotlin and I am trying to compile an open source code, that is written in Kotlin. The build using gradle is failing with error:
Unresolved reference: ofInstant
This is the line that is causing the error:
package common.time
import java.time.*
private val UTC = ZoneId.of("UTC")
fun Instant.toUtcLocalDate() = LocalDate.ofInstant(this, UTC)
I have the latest JDK installed. Any help is appreciated. Thanks
LocalDate.ofInstant()
is only in Java 9 and later. You can use ZonedDateTime.ofInstant(this, UTC).toLocalDate()
instead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.