How to determine last calendar day of month
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-01-18 07:45 PM
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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
17-01-18 10:26 PM
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...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
18-01-18 08:04 PM
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)
