首先
我不得不說,與date
工作本來waaaay更好,或者也與date.getTime
工作這返回long
。
據說
從Java端,你將不得不做這樣的事情:
Caendar c = Calendar.getIstance();
int currentDay = c.get(Calendar.DAY_OF_MONTH);
int currentMonth = c.get(Calendar.MONTH) + 1; //it's 0 based
int currentYear = c.get(Calendar.YEAR);
c.add(Calendar.DAY_OF_MONTH, 30);
int nextMonthDay = c.get(Calendar.DAY_OF_MONTH);
int nextMonthMonth = c.get(Calendar.MONTH) + 1; //it's 0 based
int nextMonthYear = c.get(Calendar.YEAR);
String myQuery = String.Format("select * from myTable where (day >= {0} and month >= {1} and year >= {2}) and (day < {3} and month <= {4} and year <= {5})", currentDay, currentMonth, currentYear, nextMonthDay, nextMonthMonth, nextMonthYear);
這將需要所有行日期> =當前和日期是< =下月
希望這會有所幫助
這是我要遵循的最佳途徑。謝謝 – Hatim