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!