cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine last calendar day of month

AdamOllerenshaw
Level 3
Hi Im working on a reporting scheduler process where I need to increment date values based on certain reporting frequencies (daily, weekly, momthly etc). As part of this, I need to be able to determine the last day of a month. For example if my original date is 28/02/2018 and I use AddMonths (1) I will get a date of 28/02/2018 - I then need a calculation to determine what the last day of march is so I can use that date. Is it possible to work this out in Blue Prism? thanks
2 REPLIES 2

Denis__Dennehy
Level 15
I've done something similar to this before - I did it by using AddDays to subtract one day from the last 1st of the following month... 

ChristopherBrow
Level 2
Hey Adam, Denis is spot on, create a date for the first of the month, add a month, subtract a day. See the bellow example which uses Today() to just calculate for the current month (replace Today() with any date in your target month) AddDays(AddMonths(MakeDate(1, FormatDate(Today(), ""MM""), FormatDate(Today(), ""yyyy"")), 1), -1)