Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Reference » SQL Functions » Alphabetical list of functions

DATENAME function [Date and time] Next Page

DATEPART function [Date and time]

Returns the value of part of a datetime value.


DATEPART( date-part, date-expression )


date-part    The date part to be returned. For a complete listing of allowed date parts, see Date parts.

date-expression    The date for which the part is to be returned.


The date must contain the date-part field.

The numbers that correspond week days depend on the setting of the first_day_of_week option. By default Sunday=7.

See also
Standards and compatibility

The following statement returns the value 5.

SELECT DATEPART( month , '1987/05/02' );