1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
468 views
by brandon-w-8204 (34.1k points)
I have a date and need to know the last day of that month

2 Answers

0 votes
 
Best answer

Here is a function you can use to get the last day of the month:

function getLastDayOfMonth(stringDate) {
   var date = qie.deduceDate(stringDate);
   var cal = java.util.GregorianCalendar.getInstance();
   cal.setTime(date);
   return cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
}

Here is an example of how to call it:

qie.debug('2/20/2017: ' + getLastDayOfMonth('2/20/2017'));

by brandon-w-8204 (34.1k points)
selected by michael-h-5027
0 votes
If you want to get the last day of the month on a source node using CRON you can use:

0 0 0 L * *
by michael-h-5027 (14.8k points)
...