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

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
(다른 사용자 한 명의 중간 판 하나는 보이지 않습니다)
4번째 줄: 4번째 줄:
==Bash==
==Bash==
[[Category: Bash]]
[[Category: Bash]]
<source lang='Bash'>
<syntaxhighlight lang='Bash'>
date +%j --date 2015-02-22
date +%j --date 2015-02-22
# 053
# 053
</source>
</syntaxhighlight>
<source lang='Bash'>
<syntaxhighlight lang='Bash'>
date +%j --date 2017-06-15
date +%j --date 2017-06-15
# 166
# 166
</source>
</syntaxhighlight>


==JavaScript==
==JavaScript==
[[분류: JavaScript]]
[[분류: JavaScript]]
<source lang='JavaScript'>
<syntaxhighlight lang='JavaScript'>
var d = new Date('2015-02-22');
var d = new Date('2015-02-22');
var day_of_year = Math.floor( (d - new Date(d.getFullYear(), 0, 0)) / 86400000 );
var day_of_year = Math.floor( (d - new Date(d.getFullYear(), 0, 0)) / 86400000 );
console.log( day_of_year );
console.log( day_of_year );
// 53
// 53
</source>
</syntaxhighlight>
<source lang='JavaScript'>
<syntaxhighlight lang='JavaScript'>
function day_of_year(str) {
function day_of_year(str) {
   var d = new Date(str);
   var d = new Date(str);
28번째 줄: 28번째 줄:
console.log( day_of_year('2017-06-15') );
console.log( day_of_year('2017-06-15') );
// 166
// 166
</source>
</syntaxhighlight>


==SQL==
==SQL==
34번째 줄: 34번째 줄:
===MySQL===
===MySQL===
[[분류: MySQL]]
[[분류: MySQL]]
<source lang='MySQL'>
<syntaxhighlight lang='MySQL'>
SELECT DAYOFYEAR('2015-02-22');
SELECT DAYOFYEAR('2015-02-22');
-- 53
-- 53
</syntaxhighlight>
<syntaxhighlight lang='MySQL'>
SELECT DAYOFYEAR("2017-06-15");
SELECT DAYOFYEAR("2017-06-15");
-- 166
-- 166
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:40 기준 최신판

1 개요[ | ]

함수 DAYOFYEAR()

2 Bash[ | ]

date +%j --date 2015-02-22
# 053
date +%j --date 2017-06-15
# 166

3 JavaScript[ | ]

var d = new Date('2015-02-22');
var day_of_year = Math.floor( (d - new Date(d.getFullYear(), 0, 0)) / 86400000 );
console.log( day_of_year );
// 53
function day_of_year(str) {
  var d = new Date(str);
  return Math.floor( (d - new Date(d.getFullYear(), 0, 0)) / 86400000 );
}
console.log( day_of_year('2017-06-15') );
// 166

4 SQL[ | ]

4.1 MySQL[ | ]

SELECT DAYOFYEAR('2015-02-22');
-- 53
SELECT DAYOFYEAR("2017-06-15");
-- 166

5 같이 보기[ | ]

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