SELECT COUNT(1)
FROM
(SELECT TO_CHAR(TRUNC(SYSDATE,'mm')+ROWNUM-1,'day','NLS_DATE_LANGUAGE=American') d
FROM DUAL
CONNECT BY ROWNUM<=TO_NUMBER(TO_CHAR(LAST_DAY(SYSDATE),'dd'))
)
WHERE trim(d)='monday';
------解决方案-------------------- public int getWeek(String... val) {
Calendar calendar = Calendar.getInstance();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
if (val == null ------解决方案-------------------- val.length == 0)
calendar.setTime(new Date());
else
try {
Date d = df.parse(val[0]);
calendar.setTime(d);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// System.out.println("是第" + calendar.get(Calendar.WEEK_OF_YEAR) + "周");
return calendar.get(Calendar.WEEK_OF_MONTH);
} ------解决方案-------------------- 你只需把一个月的最后的一天的日期输入进去,就会告诉你这天是这个月的第几周。结果好像也就知道了 ------解决方案-------------------- CREATE OR REPLACE FUNCTION longToChar(value in number, format in varchar2) return varchar2 is
Result varchar2(100);
tempFormat varchar2(100);
begin
--'YYYY-MM-DD HH24:MI:SS'
if format = '' then
tempFormat := 'YYYY-MM-DD HH24:MI:SS';
else
tempFormat := format;
end if;
select to_char((select to_date('19700101080000', 'yyyymmddhh24miss') +
value / 86400
from dual),
tempFormat)
into Result
from dual;
return(Result);
end longToChar;