Link to home
Start Free TrialLog in
Avatar of huzefaq
huzefaq

asked on

How to get the month from todays date

I actually need the current month. So I was sing the following code
But the problem is that when I print the month, it gives me 5 instead of 6 which is the current month.

Any help will be greatly appreciated. When I print the whole date, it prints the right date

Date todays_date  = new Date();
      String this_month = new Integer(todays_date.getMonth()).toString();
      out.print(this_month);
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial