DATE Function

Description

The DATE function extracts the date part from specified argument, and returns it as MM/DD/YYYY' format string. Arguments that can be specified are DATE, TIMESTAMP and DATETIME types. The return value is a VARCHAR type.

0 is not allowed in the argument value corresponding to year, month, and day; however, if 0 is inputted in every argument value corresponding to date and time, string where 0 is specified for every date value is returned.

Syntax

DATE(date)

Example

SELECT DATE('2010-02-27 15:10:23');

 date('2010-02-27 15:10:23')

==============================

  '02/27/2010'

 

SELECT DATE(NOW());

 date( SYS_DATETIME )

======================

  '04/01/2010'

 

SELECT DATE('0000-00-00 00:00:00');

 date('0000-00-00 00:00:00')

===============================

 '00/00/0000'