SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyyMMddHHmmssMM"); Date MyDate = new Date(System.currentTimeMillis()); //取系统时间 String time = sDateFormat.format(MyDate);你想用什么控件显示啊? 现在这个 time 就是时间了 想怎么显示你看你需要了
Date MyDate = new Date(Calendar.getInstance().getTime()); //取系统时间 如果生命MyDate改成这样也可以 楼住可以自己看看有什么不同
timer = new Timer(true); timer.schedule(new java.util.TimerTask() { public void run() { //server.checkNewMail(); 检查新邮件 } }, 0, 5*60*1000); //5*60*1000代表5分钟
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyyMMddHHmmssMM");这个为什么显示不出系统时间,显示的结果却是java.text.SimpleDateFormat@dd590b00? 请问是怎么回事?
Date MyDate = new Date(System.currentTimeMillis()); //取系统时间
String time = sDateFormat.format(MyDate);你想用什么控件显示啊?
现在这个 time 就是时间了
想怎么显示你看你需要了
如果生命MyDate改成这样也可以
楼住可以自己看看有什么不同
timer.schedule(new java.util.TimerTask() {
public void run() {
//server.checkNewMail(); 检查新邮件
}
}, 0, 5*60*1000); //5*60*1000代表5分钟
请问是怎么回事?
public void run(){
while(Matrix.property.programRun){
try {
sleep(1000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
updateDateTime();
}
}
/** 读取系统时间并回显 */
private void updateDateTime(){
Calendar cur = Calendar.getInstance();
String date = String.format("%1$tF",cur);
curDateTf.setText(date);
String time = String.format("%1$tT",cur);
curTimeTf.setText(time);
}
}