Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Calendar class

 
nirmal Rchavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Its nice to know there is forum like this to help us all GreenHorns..

I would like to know is there a Calendar component in swings like "JCalendar" or some thing.
I have designed a popupcalendar using the regular swing components where i have made use of Calendar class
Calendar c = Calendar.getInstance();
and i am extracting individual fields such as time, day, year etc...
using
c.get(c.YEAR),c.get(c.MONTH)etc... value returned by these functions are integers (00-for january,01- for feb) and 07- for current year.
However, how i wanted in my application is in string format like
Jan,Feb..for months
and 2007,2008..for years.


Thanks in advance.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49411
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I can help you a lot, but Horstmann's book says to look on www.toedter.de for a reusable Calendar display.

And welcome to the Ranch.

Go through the documentation for java.util.Formatter here, and find the formatting tabs which begin with %t or %T. You will find several different ways to print months there.
 
nirmal Rchavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot sheriff..
that definatly helped, i am able to extract the required fields now.
 
nirmal Rchavan
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot sheriff..
that definatly helped, i am able to extract the required fields now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic