Basically, I created a webapp meeting planner using Java servlets. It is heavily dependent on javas Calendar. All this was developed on my mountain lion macbook with jdk 1.6.
Now, when testing on my computer, I had some strange results.
Duration:
System.out.println("selected = "+selected); Calendar now = Calendar.getInstance(); System.out.println("a "+now.getTime()); now.setTimeInMillis(selected); System.out.println("b "+now.getTime()); now.set(Calendar.MILLISECOND,0); now.set(Calendar.SECOND,0); now.set(Calendar.MINUTE,0); now.set(Calendar.HOUR_OF_DAY,6);
on the PC will output:
selected = 1355835600000 a Wed Dec 19 19:35:36 EST 2012 b Wed Dec 19 00:00:00 EST 2012 d Wed Dec 19 06:00:00 EST 2012 e Sun Dec 23 06:00:00 EST 2012
Nevertheless, it will be displayed on the macro:
selected = 1355835600000 a Wed Dec 19 19:33:57 EST 2012 b Wed Dec 19 00:00:00 EST 2012 d Wed Dec 19 06:00:00 EST 2012 e Sun Dec 16 06:00:00 EST 2012
As we can see here, if I build a table representing the weekly schedule with these values, the mac will start at 6am on Sunday, which is contained in the current week. But the PC will start at 6am on Sunday, which will be presented next week.
This means that any assignments that I create are not synchronized on the PC (on different days before the expected) Note: the computer was tested with both jdk1.6 and jdk1.7
Does anyone know any solutions or reasons for this?
thanks
source share