"함수 DAYOFWEEK()"의 두 판 사이의 차이

19번째 줄: 19번째 줄:
[[분류: MySQL]]
[[분류: MySQL]]
<source lang='MySQL'>
<source lang='MySQL'>
SELECT DAYOFWEEK("2017-06-16");
SELECT DAYOFWEEK("2017-09-16");
-- 6
SELECT DAYOFWEEK("2017-06-17");
-- 7
-- 7
SELECT DAYOFWEEK("2017-06-18");  
SELECT DAYOFWEEK("2017-09-17");
-- 1
-- 1
SELECT DAYOFWEEK("2017-09-18");
-- 2
</source>
</source>



2017년 9월 15일 (금) 22:27 판

1 개요

함수 DAYOFWEEK()

2 PHP

echo date('N', strtotime('2017-09-16'));
# 6
echo date('N', strtotime('2017-09-17'));
# 7
echo date('N', strtotime('2017-09-18'));
# 1

3 SQL

3.1 MySQL

SELECT DAYOFWEEK("2017-09-16");
-- 7
SELECT DAYOFWEEK("2017-09-17");
-- 1
SELECT DAYOFWEEK("2017-09-18"); 
-- 2

4 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}