//์์์ผ, ์ข
๋ฃ์ผ ์ฌ์ด ์ผ์ ๊ณ์ฐ(yyyymmdd ํ์)
function calDiffDays(startDate, endDate) {
//์์์ผ
const strDt = new Date(startDate.substring(0,4), startDate.substring(4,6), startDate.substring(6,8));
//์ข
๋ฃ์ผ
const endDt = new Date(endDate.substring(0,4), endDate.substring(4,6), endDate.substring(6,8));
//์ผ์ ์ฐจ์ด(์ ๋๊ฐ)
let diffDays = Math.abs(endDt.getTime() - strDt.getTime());
//ํ๋ฃจ(๋ฐ๋ฆฌ์ธ์ปจ๋)๋ก ๋๋ ๋ค ๋ฐ์ฌ๋ฆผ
return Math.floor(diffDays / (1000 * 60 * 60 * 24));
}
์๋ฐ์คํฌ๋ฆฝํธ ๋ ์ง๊ฐ์ ์ฐจ์ด ๊ตฌํ๊ธฐ ( yyyyMMdd ํ์ )
์๋ฐ์คํฌ๋ฆฝํธ ๋ ์ง๊ฐ์ ์ฐจ์ด ๊ตฌํ๊ธฐ ( yyyyMMdd ํ์ ) javascript์์ ๋๋ ์ง๊ฐ์ ์ฐจ์ด ์ผ์๋ฅผ ๊ตฌํด์ผํ ์ผ์ด ์์๋ ์ฌ์ฉํ๋ฉด ๋๋ค. function betweenDay(firstDate, secondDate) { var firstDateObj = new Date(firstDate.sub
www.appletong.com
'IT > development' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[mybatis] selectkey๊ฐ return(Oracle) (0) | 2023.05.06 |
---|---|
[mybatis] ๊ฒ์(Oracle) (0) | 2023.05.06 |
[thyemeleaf] form ๊ฒ์๊ฐ ์ ์ง (0) | 2023.04.26 |
[thyemeleaf] get ๋ฐฉ์ parameter๊ฐ ๋ถ์ด๊ธฐ (0) | 2023.04.26 |
[thyemeleaf] select option๊ฐ list loop (0) | 2023.04.26 |
๋๊ธ