Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RETRIEVING MONTH FROM GREGORIAN CALENDAR OBJECT

 
vernon mweetwa
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic