cancel
Showing results for 
Search instead for 
Did you mean: 

Previous Date Logic

sandeshtope
Level 5

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!



------------------------------
Sandy P
RPA Developer
------------------------------
12 REPLIES 12

@MichealCharron - My bad - This scenario slipped out of my testing mind, thanks for pointing this out and correcting. Cheers !!



------------------------------
Regards,

Mukesh Kumar - Senior Automation Developer

NHS, England, United Kingdom, GB
------------------------------
Regards,

Mukesh Kumar

Hi Mike, 

That was nice catch, I was about to correct the same.

But still, I think I'll just share my approach as well, which I think is Simpler and correct in one scenario!

AddMonths(ToDate(FormatDate(Today(), "MM/15/yyyy")), -1)

ToDate(FormatDate(Today(), "MM/15/yyyy")

The one scenario is that Blue Prism works on mm/dd/yyyy format and ToDate("15/10/2023")  will fail. (Do let me know what you think)

Hope this Helps!



------------------------------
WeitghtRPAMatey
------------------------------
WeitghtRPAMatey

@Rohit Srivastava

The hard coded value...nice. 

As an aside; most people don't realize that you can put almost anything in the string for a "Format" parameter in the FormatDate() function. Even formatting characters can be used in the string to represent their literal values as long as they are enclosed in double quotes. 

For eg., the following string would be unusable to come out with a folder structure from a single FormatDate() function:

17730.png
But using double quotes and escaping back-slashes with another back-slash makes it work:
17731.png



------------------------------
Micheal Charron
Senior Manager
RBC
America/Toronto
------------------------------

Micheal Charron
RBC
Toronto, Ontario
Canada