@malayo: the code posted is sufficient, no other inputs are required. You should study that code, read the Calendar and Date APIs, and follow a tutorial on Calendar/Date/time to better understand.