How to get the week day name from a date?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 20:22:47

问题


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?


回答1:


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.)




回答2:


Sorry for a too late answer. but someone might come to this post and see this .

Use

You can use other options in 2nd parameter as it has a lot of variety.



来源:https://stackoverflow.com/questions/8004645/how-to-get-the-week-day-name-from-a-date

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!