DATEPART

Description

This function returns an integer representing the specified datepart of the specified date. (DATEPART in Transact-SQL).

Sample Source Pattern

Syntax

DATEPART ( datepart , date )  

Examples

Code:

IN -> SqlServer_01.sql
SELECT DATEPART(YEAR, '10-10-2022') as YEAR

Result:

YEAR |
-----+
 2022|

Last updated