Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calendar.getInstance() returns wrong date!

Status
Not open for further replies.

shine67

Programmer
Jan 11, 2002
41
0
0
US
Hi,

I am trying to get the system time and by using

Calendar right_now = Calendar.getInstance();

It returns 3/28/04 while today is 4/28/04. Any idea? Or is there any other method of getting today's date?

Thanks,
Shine
 
The month in the Calendar starts in 0. January = 0, February = 1, etc

That is very explicit in the documentation.

You can also get today's date by creating a new instance of Date for example.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top