This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes RETRIEVING MONTH FROM GREGORIAN CALENDAR OBJECT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "RETRIEVING MONTH FROM GREGORIAN CALENDAR OBJECT" Watch "RETRIEVING MONTH FROM GREGORIAN CALENDAR OBJECT" New topic
Author

RETRIEVING MONTH FROM GREGORIAN CALENDAR OBJECT

vernon mweetwa
Greenhorn

Joined: Nov 26, 2004
Posts: 24
Hi all,

i am able to get the full date in the form day, month, year. now what i want is to get only the month from this date and pass it to a JSP page because currently i am passing the whole date in full.

i have tried to use getMonth() but it is not supported. in what way should i retrieve the month. below is the reflection of the code:

public PepfarReportForm getPepfarReportForm(int site, GregorianCalendar startGreg, GregorianCalendar endGreg )
{
PepfarReportForm prfForm = new PepfarReportForm();
try{
Date start = new Date( startGreg.getTimeInMillis() );
Date end = new Date( endGreg.getTimeInMillis() );
Date startMonth = start;
Date endMonth = end;

String myString = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK).format(start);



prfForm.setMonth( myString );




System.out.println("Date start" + " "+prfForm.getMonth() );
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336



JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
wood burning stoves
 
subject: RETRIEVING MONTH FROM GREGORIAN CALENDAR OBJECT