Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the week day name from a date?

Given 03/09/1982 how can we say it is which week day. In this case it will be Tue.

Is it possible to get in a single query?

like image 320
user1025901 Avatar asked Nov 04 '11 03:11

user1025901


1 Answers

SQL> SELECT TO_CHAR(date '1982-03-09', 'DAY') day FROM dual;  DAY --------- TUESDAY  SQL> SELECT TO_CHAR(date '1982-03-09', 'DY') day FROM dual;  DAY --- TUE  SQL> SELECT TO_CHAR(date '1982-03-09', 'Dy') day FROM dual;  DAY --- Tue 

(Note that the queries use ANSI date literals, which follow the ISO-8601 date standard and avoid date format ambiguity.)

like image 109
Zohaib Avatar answered Oct 11 '22 04:10

Zohaib