Oracle 查询今日.昨日.本周.本月和本季度的所有记录 字段类型为date 今日 select * from 表名 where to_char(字段名,'dd')=to_char(sysdate,'dd') 昨日 ,'dd') 本周 select * from 表名 where to_char(字段名,'iw')=to_char(sysdate,'iw') 本月 select * from 表名 where to_char(字段名,'mm')=to_char(sysdate,'mm') 本季
在oracle里,如何取得本周.本月.本季度.本年度的第一天和最后一天的时间 --本周 select trunc(sysdate,'d')+1 from dual; select trunc(sysdate,'d')+7 from dual; --本月 select trunc(sysdate,'mm') from dual; select last_day(trunc(sysdate)) from dual; --本季 select trunc(sysdate,'Q') from dual;
/** * 针对时间的工具类 */ var DateTimeUtil = function () { /*** * 获得当前时间 */ this.getCurrentDate = function () { return new Date(); }; /*** * 获得本周起止时间 */ this.getCurrentWeek = function () { //起止日期数组 var startStop = new Array(); //获取当前时间 var currentDate = this