Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

DATE

Example

Retrieve only the date portion.

SELECT DATE(“2017-06-15”);

Definition and Usage

The DATE() function isolates the date component from a datetime expression.

Syntax

DATE(expression)

Parameter Values

Parameter

Description

expression

The DATE() function isolates the date component from a datetime expression.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Obtain the date component.

SELECT DATE(“2017-06-15 09:34:21”);

Example

Isolate the date component (may return NULL).

SELECT DATE(“The date is 2017-06-15”);

Example

Retrieve the date component.

SELECT DATE(OrderDate) FROM Orders;