Q:

how can I change month only in java date object?

I have java date object.
How can I change its month without changing the year.
e.g.
12/1/14
I want to change it to
12/3/14 and to 12/10/14
I basically want to change the month by +/- x month without changing the year.
Can it be done?

A:

Calendar cal = Calendar.getInstance();
cal.setTime(date); // your date (java.util.Date)
cal.add(Calendar.MONTH, x); // You can -/+ x months here to go back in history or move forward.
return cal.getTime(); // New date

ref : Java Calendar

A:

You can use the set method of the Calendar class to change the specific month you want
sample:
Calendar c = Calendar.getInstance();
System.out.println(c.getTime());
c.set(Calendar.MONTH, Calendar.JANUARY); //will change the month to JANUARY
System.out.println(c.getTime());

result:
Sun Aug 17 03:17:35 EDT 2014
Fri Jan 17 03:17:35 EST 2014

A:

java.time
LocalDate localDate = LocalDate.of ( 2017, Month.JANUARY, 23 );
LocalDate localDateFeb = localDate.withMonth ( 2 );

…or…
LocalDate localDateFeb = localDate.withMonth ( Month.FEBRUARY.getValue ( ) );

localDate.toString(): 2017-01-23
localDateFeb.toString(): 2017-02-23

The other Answers use the troublesome old date-time classes, now supplanted by the java.time classes.

About java.time
The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, & SimpleDateFormat.
The Joda-Time project, now in maintenance mode, advises migration to the java.time classes.
To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310.
Where to obtain the java.time classes? 

Java SE 8 and SE 9 and later

Built-in. 
Part of the standard Java API with a bundled implementation.
Java 9 adds some minor features and fixes.

Java SE 6 and SE 7

Much of the java.time functionality is back-ported to Java 6 & 7 in ThreeTen-Backport.

Android

The ThreeTenABP project adapts ThreeTen-Backport (mentioned above) for Android specifically.
See How to use ThreeTenABP….

The ThreeTen-Extra project extends java.time with additional classes. This project is a proving ground for possible future additions to java.time. You may find some useful classes here such as Interval, YearWeek, YearQuarter, and more.

Joda-Time
Update: The Joda-Time project is now in maintenance mode, with the team advising migration to the java.time classes.
The Joda-Time library has a LocalDate class to represent a date-only without a time-of-day nor time zone.
You can arbitrarily set the month value. But beware of the issue that not all months have the same number of days, so having day-of-month values of 29, 30, and 31 are a problem.
LocalDate localDate = new LocalDate( 2014 , 12 , 31 ); // December.
LocalDate localDate_Feb = localDate.withMonthOfYear( 2 ); // February.

Dump to console.
System.out.println( "localDate: " + localDate );
System.out.println( "localDate_Feb: " + localDate_Feb ); 

When run.
localDate: 2014-12-31
localDate_Feb: 2014-02-28

