做的时候发现一个怪问题,在索爱模拟器T610和T630上运行正常的程序,通过蓝牙发到T628上就运行错误,奇怪~~~~谁能给我解释一下呀~~~
操作日期的类如下:
/*
* Created on 2005-1-14
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.booolee;
import java.util.*;
/**
* @author libo
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class BOBO_Date {
/**
* 对日期进行增/减量操作
* @param d 日期
* @param days 增量天数
* @return Date
*/
public Date add(Date d,int days){
int Year,Month,Month2,Month_r,Day,Day2,Day_r,i;
boolean rYear;
int DayOfMonths[]={31,28,31,30,31,30,31,31,30,31,30,31};
Calendar cal;
cal=Calendar.getInstance();
cal.setTime(d);
Year=cal.get(cal.YEAR);
Month=cal.get(cal.MONTH);
Day=cal.get(cal.DAY_OF_MONTH);
Day2=Day+days;
//判断是否为闰年
if (( Year % 4 == 0 && Year % 100 != 0)||Year % 400 == 0) {
rYear=true;
}else{
rYear=false;
}
//如果是闰年,2月份就是29天否则是28天
if (rYear){
DayOfMonths[1]=29;
}else{
DayOfMonths[1]=28;
}
//跨度为几个月,请求出结果月
i=0;
while (true){
if ((Month+i)>11){
Month=1;
i=0;
Year++;
}
Day_r=Day2;
Day2=Day2-DayOfMonths[Month+i];
if (Day2<0){
Month_r=Month+i+1;
break;
}else{
i++;
}
}
cal.set(cal.YEAR,Year);
cal.set(cal.MONTH,Month);
cal.set(cal.DAY_OF_MONTH,Day_r);
return cal.getTime();
}
}
本文地址:http://com.8s8s.com/it/it11820.htm