DAY

The DAY function returns the day part of a value.

Syntax

DAY ( expression )

expression

An expression that can be any of the following:

Results

The returned result is an integer value in the range 1 to 31.

If the argument can be NULL, the result can be NULL; if the argument is NULL, the result is the NULL value.

Examples

Get the current date:

splice> VALUES(CURRENT_DATE);
1
--------
2015-10-25

1 row selected

Now get the current day only:

splice> VALUES(DAY(CURRENT_DATE));
1
--------
25

1 row selected

Get the day number for each player’s birthdate:

splice> select Day(Birthdate) AS "Day-of-Birth"
   FROM Players
   WHERE ID < 20
   ORDER BY "Day-of-Birth";
Day-of-Bir&
-----------
1
2
5
6
11
12
13
15
16
17
20
21
21
21
22
24
27
30
30

19 rows selected

See Also