Skip to main content

CURRENT_DATE (SQL)

A date/time function that returns the current local date.

Synopsis

CURRENT_DATE

Examples

The following example returns the current date, converted to Display mode:

SELECT CURRENT_DATE AS Today

The following Embedded SQL example returns the current date as stored. Because this date is stored in $HOROLOG format, it is returned as an integer:

  &sql(SELECT CURRENT_DATE INTO :a)
   IF SQLCODE'=0 {
     WRITE !,"Error code ",SQLCODE }
   ELSE {
     WRITE !,"Current date is: ",a }

The following example shows how CURRENT_DATE can be used in a WHERE clause to return records of people born in the last 1000 days:

SELECT Name,DOB,Age
FROM Sample.Person
WHERE DOB > CURRENT_DATE - 1000

See Also

CURDATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURTIME, GETDATE, GETUTCDATE, NOW

FeedbackOpens in a new tab