날짜 계산하기
타입이 date, datetime인 컬럼 nnn이 있다고 하면
날짜만 넣기
update tbl set nnn=curdate() where idx=124;
시각까지 넣기
update tbl set nnn=now() where idx=124;
nnn에 3일 더하기
update tbl set nnn = nnn + interval 3 day where idx=124;
날짜 타입 mmm이 더 있다고 하고
select to_days( nnn)- to_days(mmm) from tbl
두 날짜 값의 차이를 날 수로 계산
4.1이후에는 DATEDIFF() 전용 함수가 있습니다.<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:27:00 MySQL에서 이동 됨]</div>
날짜만 넣기
update tbl set nnn=curdate() where idx=124;
시각까지 넣기
update tbl set nnn=now() where idx=124;
nnn에 3일 더하기
update tbl set nnn = nnn + interval 3 day where idx=124;
날짜 타입 mmm이 더 있다고 하고
select to_days( nnn)- to_days(mmm) from tbl
두 날짜 값의 차이를 날 수로 계산
4.1이후에는 DATEDIFF() 전용 함수가 있습니다.<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:27:00 MySQL에서 이동 됨]</div>
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 1개
감사합니다.