DAYNAME( ) returns the complete day name. : DAYNAME « Date Time « SQL / MySQL






DAYNAME( ) returns the complete day name.

     
mysql>
mysql> CREATE TABLE date_val
    -> (
    ->  d       DATE
    -> );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> INSERT INTO date_val (d) VALUES('1864-02-28');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO date_val (d) VALUES('1900-01-15');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO date_val (d) VALUES('1987-03-05');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO date_val (d) VALUES('1999-12-31');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO date_val (d) VALUES('2000-06-04');
Query OK, 1 row affected (0.00 sec)

mysql>
mysql>
mysql> SELECT d, DAYNAME(d), LEFT(DAYNAME(d),3) FROM date_val;
+------------+------------+--------------------+
| d          | DAYNAME(d) | LEFT(DAYNAME(d),3) |
+------------+------------+--------------------+
| 1864-02-28 | Sunday     | Sun                |
| 1900-01-15 | Monday     | Mon                |
| 1987-03-05 | Thursday   | Thu                |
| 1999-12-31 | Friday     | Fri                |
| 2000-06-04 | Sunday     | Sun                |
+------------+------------+--------------------+
5 rows in set (0.00 sec)

mysql>
mysql> drop table date_val;
Query OK, 0 rows affected (0.00 sec)

   
    
    
    
    
  








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.Get the name of the day
6.DayName returns Monday, Tuesday ...
7.Use DAYNAME( ) to display weekday names instead.