I use Nokia 2600C to test my application(based on j2me),and after testing about 1~4 hours ,my date always goes wrong.
eg: now is 2011-01-26, 10:58:30, I printed this through my bluetooth printer,and I continue to test.After a while,it's become:
2011-03-17, 18:31:42,
You see,that's wrong.But,the cellphone's time is right,I tried to use TimeZone()、Calendar、Date,I even tried NOT use these,only use:System.currentTimeMillis() ,but still,it goes wrong.So,that's odd,we can not change the kvm's time right?We can set time,set date,read it,but we can't change :System.currentTimeMillis(),so why it's wrong?
Is there something wrong with the cellphone's KVM?
My code:
PHP Code:TimeZone tz = TimeZone.getDefault();
Calendar calendar1 = Calendar.getInstance(tz);
saveTime[0] = String.valueOf(calendar1.get(Calendar.YEAR));
saveTime[1] = UtilComm.padLeft(String.valueOf(calendar1 //if it's :1 or 2 or 3......it will be 01 or 02 or 03.......
.get(Calendar.MONTH) + 1), "0");
saveTime[2] = UtilComm.padLeft(String.valueOf(calendar1 //if it's :1 or 2 or 3......it will be 01 or 02 or 03.......
.get(Calendar.DAY_OF_MONTH)), "0");
saveTime[3] = UtilComm.padLeft(String.valueOf(calendar1
.get(Calendar.HOUR_OF_DAY)), "0");
saveTime[4] = UtilComm.padLeft(String.valueOf(calendar1
.get(Calendar.MINUTE)), "0");
saveTime[5] = UtilComm.padLeft(String.valueOf(calendar1
.get(Calendar.SECOND)), "0");
date = saveTime[0] + "/" + saveTime[1] + "/" + saveTime[2];
time = saveTime[3] + ":" + saveTime[4] + ":" + saveTime[5];
printResult(date, out, in, false);// test
printResult(time, out, in, false);// test

Reply With Quote

