This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
where i try to set time in the format specified.
But when i do a print of cal i get some values which are different from my set value as
MINUTE=10, [Not OK]
SECOND=12, [Not OK]
MILLISECOND=17 [Not OK]
Also 5th jan 2011 was wed day but the output was
I cannt get where does this difference come from. Can i get some help please..
One thing that is wrong is that you define the milliseconds value with 6 digits. Milliseconds are thousandths of a second - it can have at most 3 digits (because when it goes over 1000, it's one second).
301017 milliseconds is 301 seconds and 17 milliseconds. And that explains exactly what's happening here: the time is 13 hours, 5 minutes, 11 seconds plus 301 seconds and 17 milliseconds = 13:05:11 plus 5 minutes, 1 second, 17 ms = 13:10:12.017 -> so hours = 13, minutes = 10, seconds = 12, ms = 17, exactly what you're getting.