31-10-23 01:18 PM
I need to write two dates into a text field in the format dd.MM.yyyy. The start date should be the nearest previous 15th, and the end date should be today's date. Any tips on how to do this in Blue Prism? Your advice would be a big help! Thanks!
Answered! Go to Answer.
01-11-23 08:44 AM
Hi @Sandy P - What if today's date is 01-November - do you still want 15th of October ?
ToNumber(Left(Today(),2))>15 - Where you can decide to check the previous nearest 15th. i.e. this gives you False decision -
If False - Calculation Stage -
If True :
------------------------------
Regards,
Mukesh Kumar - Senior Automation Developer
NHS, England, United Kingdom, GB
------------------------------
31-10-23 02:01 PM
Hi Sandy,
You can try something like below.
Start Date:
Today :
31-10-23 02:51 PM
if today's date is, for instance, 31st October, I want the start date to be the nearest previous 15th, which means it should be 15th October. How can I handle this situation ?
31-10-23 03:16 PM
Hi Sandy,
You can use a decision stage to find if the today's date is crossed current month 15th. If yes, then you can get the current month 15th date else you can get the previous month 15th date.
31-10-23 03:25 PM
Hi Atibhan ,
What to provide in decision stage ?
01-11-23 05:38 AM
I tried , but it did not worked !
How can we compare date ?
01-11-23 08:44 AM
Hi @Sandy P - What if today's date is 01-November - do you still want 15th of October ?
ToNumber(Left(Today(),2))>15 - Where you can decide to check the previous nearest 15th. i.e. this gives you False decision -
If False - Calculation Stage -
If True :
------------------------------
Regards,
Mukesh Kumar - Senior Automation Developer
NHS, England, United Kingdom, GB
------------------------------
01-11-23 10:30 AM
Hey Mukesh
It worked ! Thanks a lot !!!
01-11-23 11:04 AM
Great work team 👏 Congrats @Mukesh Kumar on the best answer!
01-11-23 01:21 PM
Sorry, I just have to point out that the answer @Mukesh Kumar gave will be incorrect at least 12 times during the year. For example; the date "11/11/2023" will give you "15/15/2023" with the Replace function, which will cause an error in the ToDate function.
For any regional date formats, you can use the following for days under 16:
AddMonths(MakeDate(15, FormatDate(Today(), "MM"), FormatDate(Today(), "yyyy")),-1)
Else
MakeDate(15, FormatDate(Today(), "MM"), FormatDate(Today(), "yyyy"))
Addendum:
For any regional date formats, you can use the following for the decision:
ToNumber(FormatDate(Today(), "dd")) < 16
------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------