File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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. .
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:
subject: get the currrent month, bug
It's not a secret anymore!