CURDATE/CURRENT_DATE/CURRENT_DATE()/SYS_DATE/SYSDATE

Description

The CURDATE(), CURRENT_DATE, CURRENT_DATE, SYS_DATE, and SYSDATE are used interchangeably, and they return the current date as the DATE type (MM/DD/YYYY or YYYY-MM-DD). The unit is day.

If every argument value of date is 0, the return value is determined by the return_null_on_function_errors system parameter; if it is set to yes, then NULL is returned; if it is set to no, an error is returned. The default value is no.

Syntax

CURDATE()

CURRENT_DATE()

CURRENT_DATE

SYS_DATE

SYSDATE

Example

--it returns the current date in DATE type

SELECT CURDATE(), CURRENT_DATE(), CURRENT_DATE, SYS_DATE, SYSDATE;

 

   SYS_DATE    SYS_DATE    SYS_DATE    SYS_DATE    SYS_DATE

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

  04/01/2010  04/01/2010  04/01/2010  04/01/2010  04/01/2010

 

--it returns the date 60 days added to the current date

SELECT CURDATE()+60;

 

   SYS_DATE +60

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

   05/31/2010

 

SELECT TO_DAYS('0000-00-00');

ERROR: Conversion error in date format.