I have a requirement that , I have to add 12 hours to current date & time stamp. The Calendar add function is not working when I use with hours.(The same function is working for days).
If you are using the Calendar.HOUR field number, it will not look like it is being modified by adding 12 to it unless you also check the AM/PM setting. Try it using the Calendar. HOUR_OF_DAY field.
What happened with Calendar.add( Calendar.HOUR, n )? I think I've used that before. Maybe HOUR_OF_DAY?
You could also get the time in milliseconds, add to that, then convert back. Be sure all your calculations are longs or you can get a truncated int answer.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi