cancel
Showing results for 
Search instead for 
Did you mean: 

Last date of the month

ZahibSidiq
Level 4
Hello,    How to get last day of the month, for example the given date is 16.08.2019 and i would like to get 31.08.2019 in return. Any ideas and suggestions appreciated.   BR Zahib 
3 REPLIES 3

ErgesKokoshi
Level 2
Hi Zahib,   To get the last day of month you'll need the following data items as Number Data Item to store the current month: Month -> to calculate the month you have to use a calc stage and write the expression FormatDate(Today(),""MM"") Data Item to store the year: Year -> to calculate the year you have to use a calc stage and write the expression FormatDate(Today(),""yyyy"") Data item to store the days of the month  : NumDays Add a code stage that:            takes as Input : Month and Year           gives an Output : NumDays           On the code tab write : NumDays = System.Datetime.DaysinMonth(Year,Month)   Attached find an image of the flow    

SreekarKarna
Level 2
Hi Zahib, Your requirement can be achieved using native functions in Blueprism. Create the following data items:    1. Of Date type, which stores input date.    2. Of Number type, which stores the last date of the month.    3. Of Date type, which stores the required output date.   Now add a calculation stage with the expression:  DateDiff(9, [Date], AddMonths([Date], 1)) Another calculation stage with the expression: MakeDate([Last Day of Current Month], FormatDate([Date], ""MM""), FormatDate([Date], ""yyyy""))   First function will calculate the number of days difference between two dates:             1. Input date             2. Date of the same day in the next month. Second calculation will calculate actual last date of that month.   Please find the attachments below for better understanding. Hope it helps.   Thank you.  

ZahibSidiq
Level 4
Thank you much to both of you 🙂