1 2 3 4 5 6 7 8 9 | function DateToString(pDate) { var yyyy = pDate.getFullYear(); var mm = pDate.getMonth() < 9 ? "0" + (pDate.getMonth() + 1) : (pDate.getMonth() + 1); // getMonth() is zero-based var dd = pDate.getDate() < 10 ? "0" + pDate.getDate() : pDate.getDate(); var hh = pDate.getHours() < 10 ? "0" + pDate.getHours() : pDate.getHours(); var min = pDate.getMinutes() < 10 ? "0" + pDate.getMinutes() : pDate.getMinutes(); return "".concat(yyyy).concat("-").concat(mm).concat("-").concat(dd).concat(" ").concat(hh).concat(":").concat(min); }; | cs |
'JavaScript' 카테고리의 다른 글
자바스크립트 분 -> 일, 시간 변환 함수 (0) | 2018.07.11 |
---|---|
자바스크립트 Date 에 일, 시간, 분 더하기 (0) | 2018.07.10 |
자바스크립트 date 날짜형식 YYYY-MM-DD 변환 (0) | 2017.02.26 |
자바스크립트 날짜 차이 구하기 (0) | 2017.02.26 |