# year

@JvmName(name = "LocalDateYearExt")
fun <T : LocalDate?> Expression<T>.year(): Function<Int>

Returns the year from this date expression, as an integer.

@JvmName(name = "LocalDateTimeYearExt")
fun <T : LocalDateTime?> Expression<T>.year(): Function<Int>

Returns the year from this datetime expression, as an integer.

Note: Some JDBC drivers, like for MySQL, may return a `LocalDate` type for this SQL function, following the format `YYYY-01-01`. To avoid unexpected exceptions in this case, the MySQL connector property `yearIsDateType` should be set to `false`. Please check the documentation.

@JvmName(name = "InstantYearExt")
fun <T : Instant?> Expression<T>.year(): Function<Int>

Returns the year from this timestamp expression, as an integer.

@JvmName(name = "OffsetDateTimeYearExt")
fun <T : OffsetDateTime?> Expression<T>.year(): Function<Int>

Returns the year from this timestampWithTimeZone expression, as an integer.

@JvmName(name = "XInstantYearExt")
fun <T : Instant?> Expression<T>.year(): 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

Content copied to clipboard

Returns the year from this timestamp expression, as an integer.