# Year

@JvmName(name = "LocalDateYearFunction")
fun <T : LocalDate?> Year(expr: Expression<T>): Function<Int>

Represents an SQL function that extracts the year field from a given date expr.

@JvmName(name = "LocalDateTimeYearFunction")
fun <T : LocalDateTime?> Year(expr: Expression<T>): Function<Int>

Represents an SQL function that extracts the year field from a given datetime expr.

@JvmName(name = "InstantYearFunction")
fun <T : Instant?> Year(expr: Expression<T>): Function<Int>

Represents an SQL function that extracts the year field from a given timestamp expr.

@JvmName(name = "OffsetDateTimeYearFunction")
fun <T : OffsetDateTime?> Year(expr: Expression<T>): Function<Int>

Represents an SQL function that extracts the year field from a given timestampWithTimeZone expr.

@JvmName(name = "XInstantYearFunction")
fun <T : Instant?> Year(expr: Expression<T>): Function<Int>

### Deprecated

Deprecated due to usage of old kotlinx.datetime.Instant. The change caused by deprecation of Instant in the kotlinx.datetime (see more on https://github.com/Kotlin/kotlinx-datetime?tab=readme-ov-file#deprecation-of-instant)

#### Replace with

    Year(expr)

Content copied to clipboard

Represents an SQL function that extracts the year field from a given timestamp expr.