jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes get the currrent month, bug Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "get the currrent month, bug" Watch "get the currrent month, bug" New topic

get the currrent month, bug

Claudia Vaz
Ranch Hand

Joined: Nov 13, 2001
Posts: 44
I'm trying to get the current month with the method "getMonth" of the class "Calendar" but it does not work properly.
For example:
We are in November (month 11) and it replys 10 which is October.
Does anyone know what is the problem?
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

No problem with the API, check out the documantation. http://java.sun.com/j2se/1.3/docs/api/java/util/Calendar.html .
The month list is zero-based like arrays.
[This message has been edited by David O'Meara (edited November 23, 2001).]
Dale DeMott
Ranch Hand

Joined: Nov 02, 2000
Posts: 515
The months are zero based.

By failing to prepare, you are preparing to fail.
Benjamin Franklin (1706 - 1790)

By failing to prepare, you are preparing to fail.<br />Benjamin Franklin (1706 - 1790)
I agree. Here's the link: http://aspose.com/file-tools
subject: get the currrent month, bug
It's not a secret anymore!