Contents Index DATEDIFF function [Date and time] DATENAME function [Date and time]

ASA SQL Reference
  SQL Functions
    Alphabetical list of functions

DATEFORMAT function [Date and time]


Function 

Returns a string representing a date-expression in the specified format.

Syntax 

DATEFORMAT ( datetime-expressionstring-expression )

Parameters 

datetime-expression    The datetime to be converted.

string-expression    The format of the converted date.

For information on date format descriptions, see DATE_FORMAT option [compatibility].

Usage 

Any allowable date format can be used for the string-expression.

Standards and compatibility 
Year 2000 compliance 
It is possible to use the DATEFORMAT function to produce a string with the year value represented by only two digits. This can cause problems with year 2000 compliance even though no error has occurred.

For more information on year 2000 compliance, please see Year 2000 compliance.

See also 

DATE_FORMAT option [compatibility]

Example 

The following statement returns the value Jan 01, 1989.

SELECT DATEFORMAT( '1989-01-01', 'Mmm dd, yyyy' )

Contents Index DATEDIFF function [Date and time] DATENAME function [Date and time]