Hi,
I am trying to put a date in my class which is 2 weeks ahead of the current date.
The problem is that is shows the date as april not may?
Any help would be much appreciated.
Thanks in advance
Below is the issue.class in question

[import java.util.*;


public class Issue {
Borrower borrower;
Item item;
String returnDate;


Issue(Borrower aBorrower, Item anItem)
{
borrower = aBorrower;
item = anItem;
// This should really be automatically generated based on the system date. The system date is showing 1 month behind?
GregorianCalendar now = new GregorianCalendar();
now.add(GregorianCalendar.DAY_OF_MONTH,14);
returnDate = "Return Date: " + now.get(GregorianCalendar.DAY_OF_MONTH) + "/" + now.get(GregorianCalendar.MONTH) + "/" + now.get(GregorianCalendar.YEAR);
}


public String b()
{
return borrower.toString();
}


public String i()
{
return item.toString();
}


public String getReturnDate()
{
return returnDate;
}


public static void main(String args[])
{
Borrower aBorrower = new Borrower("David","Leicester","BTEC Computing");
Item cItem = new Item("Mac User","Magazine");
Issue issue = new Issue(aBorrower, cItem);


System.out.println(issue.b());
System.out.println(issue.i());
System.out.println(issue.getReturnDate());
}
}]

read the documentation. And remember that in Java (as in all C inspired languages) indices are 0-based (and yes, there are some discrepancies in that, in Java as elsewhere).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.