mysql 을 사용중이라면 오늘이 몇년도의 몇번째 주 인지를 알수가 있다.
기본적으로 주를 구분하는 요일은 월요일로 되어있고 이 설정 역시 변경이 가능하다.
예제는 아래와 같다.
SELECT YEARWEEK('2024-01-01'); -> 202401 |
좀더 자세한 내용은 아래 사이트 참고 바란다.
https://www.w3schools.com/Sql/func_mysql_yearweek.asp
MySQL YEARWEEK() Function
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
또한 특정 날짜가 무슨 요일인지는 아래처럼 사용이 가능하다.
SELECT WEEKDAY('2024-01-02'); -> 1 |
(0 = Monday, 1 = Tuesday, … 6 = Sunday).
역시 추가 내용은 사이트에서 참고 가능하다.
https://www.w3schools.com/mysql/func_mysql_weekday.asp
MySQL WEEKDAY() Function
W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.
www.w3schools.com
'IT > Database' 카테고리의 다른 글
Not Like In 관련 (17) | 2024.05.22 |
---|---|
[Mysql] 문자를 숫자로 변환하는 방법(CAST / CONVERT) (15) | 2024.05.21 |
[Mysql] sql_mode=only_full_group_by (28) | 2024.04.18 |
[Mysql] 그룹함수 사용법 (with 로 사용) (38) | 2024.04.17 |
[Mysql] [Error] 1075 // auto increment 관련 오류 (19) | 2024.04.13 |
댓글