Discussion

To get Number of days for given month

Is there any function to get the number of days for given month and year?? plz help me.Thanks in advance.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

January 14, 2009 - 1:30pm

Not sure if Pega has got any but you can use standard Java library and use the Calendar class. Create your own function or a java step.
A sample code is given below for your reference:
// Create a calendar object of the desired month
Calendar cal = new GregorianCalendar(1999, Calendar.FEBRUARY, 1);

// Get the number of days in that month
int days = cal.getActualMaximum(Calendar.DAY_OF_MONTH); // 28

August 22, 2016 - 7:41am
Response to SRIVASTV

Hello Srivastav,

Can you please describe more on this,thanks in advance.