/**
* Get the day after the specified start day and interval of days.
* E.g
* Start date:2003-07-18 17:45:34 iIntervalDay:1
* Return 2003-07-19 17:45:34
* @param d
* @param iIntervalDay
* @return
*/
public static Date getIntervalDayStr(Date d,int iIntervalDay)
{
Calendar c = Calendar.getInstance();
c.setTime(d);
c.add(Calendar.DATE,iIntervalDay);
return c.getTime();
}
* Get the day after the specified start day and interval of days.
* E.g
* Start date:2003-07-18 17:45:34 iIntervalDay:1
* Return 2003-07-19 17:45:34
* @param d
* @param iIntervalDay
* @return
*/
public static Date getIntervalDayStr(Date d,int iIntervalDay)
{
Calendar c = Calendar.getInstance();
c.setTime(d);
c.add(Calendar.DATE,iIntervalDay);
return c.getTime();
}
mydate是你mysql数据库中的datetime
public int getDays(Date sd,Date ed){
return (ed.getTime() - sd.getTime()) / (3600*24*1000)
}
我不知如何将sql.date转成 util.date的.
java.sql.date xx;//xx有日期
java.util date xx=new java.util.date(xx.getTime)