import java.util.Calendar;
public class A1_1 {
public static void main(String[] args){
Calendar alr=Calendar.getInstance();
Yestodayime(alr);
}
public static void Yestodayime(Calendar alr){
alr.add(Calendar.DAY_OF_MONTH, -1);
sop((alr.get(Calendar.YEAR )+"年")+(alr.get(Calendar.MONTH)+1)+"月"+(alr.get(Calendar.DAY_OF_MONTH)+"日:昨天这个时间的时间为:")
+(alr.get(Calendar.HOUR)+12)+"时"+alr.get(Calendar.MINUTE)+"分"+alr.get(Calendar.SECOND)+"秒");
}
public static void sop(Object obj){
System.out.println(obj);
}
}
//这是我的做法,希望对你有帮助
|