This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In my java class I get a date from database and I am then formatting it using this code SimpleDateFormat formatter = new SimpleDateFormat ("yyyyMMddhhmm"); String duedate = formatter.format(duedate); so now I have something like 200311211130. I need to add 6 hours to this date, How can I do this? How can you add few hours of time to date?
First of all, most of the Date class has been deprecated. So, read up on the Calendar class and a concrete subclass called GregorianCalendar. There's plenty of example code and documentation for what you want to do. If you ever need to mess with databases and dates, then look at java.sql.Date. Have fun!