获得某个月的天数(java, mysql, oracle)
java方式:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR,year);
cal.set(Calendar.MONTH,month+1);//2月
int maxDate = cal.getActualMaximum(Calendar.DATE);
mysql方式:
"SELECT day(LAST_DAY(‘2007-04-01'));";
oracle方式:
select to_number(add_months(to_date('2007-04','yyyy-fmmm'),1)-to_date(’2007-04','yyyy-fmmm')) daynum from dual
坚持不懈