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.
Copied from the Sun forum (I thought this was a good post on the topic that I found awhile back)
For manipulating time dates use the Calendar class. This has an 'add' and a roll method that will calculate the correct roll over values, should the time roll over to the next day etc. It also does clever things like sort out leap years etc.
so to subtract your 12hr, 30 mins:
Date myDate = new Date(); // This is the date from which you wish to subtract.
Calendar cal = Calendar.getInstance(); cal.setTime(myDate);
// Note you 'add' a negative number. i.e. subtract cal.add(Calendar.HOUR_OF_DAY, -12 ); cal.add(Calendar.MINUTE, -30 );