2 Replies - 536 Views - Last Post: 24 March 2012 - 10:31 PM Rate Topic: -----

#1 sport10  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 181
  • Joined: 21-September 10

Getting last day of each month

Posted 24 March 2012 - 07:12 PM

Does anyone know of a way to get the last day of each month in the format of mm-dd-yyyy, and then put each value in an array? I was looking around on google and there were various examples of how to get the current months last date but nothing for 12+ months. Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Getting last day of each month

#2 farrell2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 822
  • View blog
  • Posts: 2,529
  • Joined: 29-July 11

Re: Getting last day of each month

Posted 24 March 2012 - 08:07 PM

If you know how to get the last day of one month, use a for loop to simply increase the month 12 times. Think about it. Try some code, and if you can;t get it, post what you have. I am sure someone will be happy to look at it.
Was This Post Helpful? 0
  • +
  • -

#3 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Getting last day of each month

Posted 24 March 2012 - 10:31 PM

The Calendar class

http://docs.oracle.c...l/Calendar.html

has a getMaximum(<field>) which will return the maximum value for DAY_OF_MONTH
This method is abstract though so you will have to use a GregorianCalendar object
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1