这是我的代码
public java.util.Date getDelDate() {
Date m=new Date();
System.out.println("ticket date "+ m);
double d;
d=(multiply/consumption);
int days= (int) d;
System.out.println("del days "+ days);
m.setTime(m.getTime() + days * 1000 * 60 * 60 * 24);
System.out.println(m+"Delivery date");
return m;
}
public java.util.Date getRemDate() {
Date m1=new Date();
double d;
d=(multiply/consumption);
int days= (int) d-2;
System.out.println("rem days "+ days);
m1.setTime(m1.getTime() + days * 1000 * 60 * 60 * 24);
System.out.println(m1+"Remember date");
return m1;
//return remdate;
}
对于输入值multiply = 21
和consumption = 2
输出是(正确如下)
ticket date Wed Oct 02 21:43:56 IST 2013
del days 10
Sat Oct 12 21:43:56 IST 2013Delivery date
rem days 8
对于输入值multiply = 35
和consumption = 1
输出是(错误如下显示旧日期)
ticket date Wed Oct 02 21:52:07 IST 2013
del days 35
Wed Sep 18 04:49:20 IST 2013Delivery date
rem days 33
Mon Sep 16 04:49:20 IST 2013Remember date
对于输入值multiply = 1
和consumption = 0.03
输出是(错误如下显示旧日期)
ticket date Wed Oct 02 21:26:56 IST 2013
del days 33
Mon Sep 16 04:24:09 IST 2013Delivery date //date here is sept?
rem days 31
Sat Sep 14 04:24:09 IST 2013Remember date
我如何计算正确的日期?