你的public String settime()
{
Date now1=new Date();
int year=now1.getYear()+1900;
int month=now1.getMonth()+1;
int day=now1.getDate();
int hour=now1.getHours();
int minute=now1.getMinutes();
int second=now1.getSeconds();
String now_time=year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
return now_time;
}
中now应该为now1.
以上是程序问题,已经调试过了,但你现在对日期进行操作所使用的方法已经不被推荐使用了,建议用calendar类来代替。