日期查询
等于今天日期
select * from T_loginDaily where to_char(logintime,'YYYYMMDD') = (select to_char(sysdate,'YYYYMMDD') from dual)
本周日期
select * from T_loginDaily where to_char(logintime,'IW') = (select to_char(sysdate,'IW') from dual)
本月日期
select * from T_loginDaily where to_char(logintime,'YYYYMM') = (select to_char(sysdate,'YYYYMM') from dual)
本年日期
select * from T_loginDaily where to_char(logintime,'YYYY') = (select to_char(sysdate,'YYYY') from dual)
日期查询另外一种形式
select * from t_logindaily where logintime > to_date( '2010-08-01 ', 'yyyy-mm-dd ');
日期查询获得当日、当月、当日、当月、当年时间
select to_char(sysdate,'yyyy') from dual; --年
select to_char(sysdate,'Q' from dual; --季
select to_char(sysdate,'mm') from dual; --月
select to_char(sysdate,'YYYYMMDD W HH24:MI:SS') from dual;
select to_char(sysdate,'dd') from dual; --日
得到当前日期
select sysdate from dual;