Get the name of the day : DAYNAME « Date Time « SQL / MySQL






Get the name of the day

      
mysql>
mysql> CREATE TABLE IF NOT EXISTS labor_day
    -> (
    ->   id     INT     AUTO_INCREMENT PRIMARY KEY,
    ->   date   DATETIME NOT NULL
    -> );
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql> INSERT INTO labor_day (date) VALUES ("2005-09-05 12:45:30");
Query OK, 1 row affected (0.00 sec)

mysql>
mysql> # get the name of the day
mysql> SELECT DAYNAME(date) FROM labor_day;
+---------------+
| DAYNAME(date) |
+---------------+
| Monday        |
+---------------+
1 row in set (0.00 sec)

mysql>
mysql> # delete this sample table
mysql> DROP TABLE IF EXISTS labor_day;
Query OK, 0 rows affected (0.00 sec)

mysql>

   
    
    
    
    
    
  








Related examples in the same category

1.Return the name of the day: DAYNAME()
2.Treating date-and-time as Numbers
3.DAYNAME( ) is useful in conjunction with other date-related techniques.
4.Finding the Day of the Week for a Date
5.DAYNAME( ) returns the complete day name.
6.DayName returns Monday, Tuesday ...
7.Use DAYNAME( ) to display weekday names instead.