타임스탬프에서 요일 이름을 얻으려면 dayname() 함수를 사용하십시오 -
select dayname(yourColumnName) from yourTableName; Let us first create a table : mysql> create table DemoTable ( LoginDate timestamp ); Query OK, 0 rows affected (0.52 sec)
삽입 명령을 사용하여 테이블에 일부 레코드 삽입 -
mysql> insert into DemoTable values('2019-06-01'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable values('2019-06-02'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-06-03'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-06-04'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('2018-06-21'); Query OK, 1 row affected (0.09 sec)
select 문을 사용하여 테이블의 모든 레코드 표시 -
mysql> select *from DemoTable;
출력
+-----------------------+ | LoginDate | +-----------------------+ | 2019-06-01 00 :00 :00 | | 2019-06-02 00 :00 :00 | | 2019-06-03 00 :00 :00 | | 2019-06-04 00 :00 :00 | | 2018-06-21 00 :00 :00 | +-----------------------+ 5 rows in set (0.00 sec)
다음은 MySQL의 타임스탬프에서 요일 이름을 가져오는 쿼리입니다. -
mysql> select dayname(LoginDate) from DemoTable;
출력
+--------------------+ | dayname(LoginDate) | +--------------------+ | Saturday | | Sunday | | Monday | | Tuesday | | Thursday | +--------------------+ 5 rows in set (0.00 sec)