Confused about date objects
I have the following method of an invoice object:
I mean to add 30 days to the invoice date and return that as the due date. However, the code above subtracts 30 days from the invoice date instead of adding it. Upon experimenting further I found that adding anything up to 24 days worth of milliseconds will add to the invoice date, whereas 25 days or over will be subtracted. Being new to Java I have absolutely no idea why this should be so or where I'm going wrong. Can anyone help?
public Date getDueDate()
long current = invoiceDate.getTime();
Date date = new Date(current + (30 * 24 * 60 * 60 * 1000));