ODBC Server Reference Manual
Transact-SQL Language
HP NonStop ODBC Server Reference Manual—429151-002
4-19
Functions
Date Functions
The NonStop ODBC Server supports the following Transact-SQL date functions, which
manipulate datetime data:
•
DATEADD
•
DATEDIFF
•
DATEPART
•
GETDATE
Dateparts used within the functions have some restrictions, which are described
following the individual function descriptions.
DATEADD
The DATEADD function has the following syntax:
DATEADD returns a datetime value equal to the sum of date plus the number of
dateparts. Do not use a variable for date.
DATEDIFF
The DATEDIFF function has the following syntax:
DATEDIFF returns a signed integer value equal to date-2 minus date-1 in units of
the specified datepart.
DATEPART
The DATEPART function has the following syntax:
DATEPART returns the specified datepart of the specified date, expressed as an
integer.
GETDATE
The GETDATE function has the following syntax:
GETDATE returns the current date and time in SQL Server’s standard internal format
for datetime values. GETDATE takes no arguments.
DATEADD ( datepart , number , date )
DATEDIFF ( datepart , date-1 , date-2 )
DATEPART ( datepart , date )
GETDATE ( )