[MySQL] 날짜 더하기와 빼기 > db

본문 바로가기
사이트 내 전체검색

db

[MySQL] 날짜 더하기와 빼기

페이지 정보

작성자 서방님 댓글 0건 조회 165회 작성일 13-01-02 10:59

본문

mysql 

한달전 where reg_date >= date_add(now(), interval -1 month) 
하루전 where reg_date >= date_add(now(), interval -1 day) 
한시간전 where reg_date >= date_add(now(), interval -1 hour) 


+이면 후가 되겠죠!   
 
 
기타 날짜 조건
select date_format(D_time,"%Y-%m-%d") from 테이블명
select date_format(D_time,"%H:%i::%s") from 테이블명 


D_time 오늘인거 가져오기
select D_time from 테이블명 where date_format(D_time,"%Y-%m-%d") = current_date; 

등록된지 24시간이 안된거 가져오기
select D_time from 테이블명 where D_time > date_sub(now(), interval 1 day);

댓글목록

등록된 댓글이 없습니다.

Total 464건 10 페이지
게시물 검색

회원로그인

접속자집계

오늘
91
어제
84
최대
1,347
전체
154,462
Latest Crypto Fear & Greed Index

그누보드5
Copyright © 서방님.kr All rights reserved.