sql how to get day from date code example
Example 1: get day in sql
SELECT DATEPART(m, GETDATE()) as theMonth -- returns 11
SELECT DATEPART(d, GETDATE()) as theDay -- returns 20
SELECT DATEPART(yy, GETDATE()) as theYear -- returns 2013
Example 2: sql day from datetime
SET @@lc_time_names = 'fr_FR';
SELECT DAYNAME('2000-01-01') dayname;
+---------+
| dayname |
+---------+
| samedi |
+---------+