A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: Date and Time Functions

year()

The date & time function year() returns the number of the year date specified in the parameter "date_expression". The return value is of the datatype integer. The function year() is available in ASE® starting with version 15.0.

Syntax of the Date & Time Function year()

    year(date expression)
    

The parameter "date expression" of the Date & Time Function year()

date expression
The parameter "date expression" is a placeholder for a date, which can be specified in the format of a datetime, smalldatetime, date (starting with ASE® version 15.0), time (starting with ASE® version 15.0) datatype or as character string in date format. The parameter "date expression" must be set in quotes.

Example for the Date & Time Function year()

    select year(getdate())
go
-----

Returns the current year based on the operating system time.

    select year()
go
-----

Returns the current year based on the operating system time. The Function year() can be compared to the datepart(yy, date expression) function.

See also:

ASE T-SQL - Aggregate Functions,
Date and Time Functions,
dateadd(),
datediff(),
datename(),
datepart(),
date_part,
day(),
getdate(),
month(),
style numbers.