Java Date setDate() Method
The setDate() method of Java Date class sets the day of the month of this date object to the specified argument. This method changes the date object so that it can represent a point in time within the specified day of the month, with the given year, month, hour, minute, and second same as interpreted in the local time zone.
This method is deprecated as of JDK version 1.1 and is replaced by Calendar.set(Calendar.DAY_OF_MONTH, int date).
date - the day of month value between 1 and 31.
Example 1Test it Now
Old date is : 29 Date after setting is : 10