date
-
[mysql] DB 기간별 SELECT 방법Database/mysql 2021. 5. 28. 11:31
하루 SELECT * FROM 테이블명 WHERE 날짜컬럼명 BETWEEN DATE_ADD(NOW(),INTERVAL -1 DAY ) AND NOW(); 일주일 SELECT * FROM 테이블명 WHERE 날짜컬럼명 BETWEEN DATE_ADD(NOW(),INTERVAL -1 WEEK ) AND NOW(); 한달 SELECT * FROM 테이블명 WHERE 날짜컬럼명 BETWEEN DATE_ADD(NOW(),INTERVAL -1 MONTH ) AND NOW();
-
[javascript] date time difference, 날짜 시간 비교 함수Programing/javascript 2020. 9. 9. 09:42
- 시간 절대값 비교(날짜 무시) const HOUR_TO_SEC = 3600; const MINUTE_TO_SEC = 60; const timeDiff = (_date1: any, _date2: any) => { const diff = moment.utc(moment(_date1, "YYYY-MM-DD HH:mm:ss").diff(moment(_date2, "YYYY-MM-DD HH:mm:ss"))).format("HH:mm:ss"); const hour_to_second = parseInt(diff.substring(0, 2)) * HOUR_TO_SEC; const minute_to_second = parseInt(diff.substring(3, 5)) * MINUTE_TO_SEC; const sec..