Hi @Youri98 I hope you are doing well.
Besides the other recommendations which are great btw, you can use Python to get the last day of the previous month:
See the snippet code below:
SET DateFormat1 TO $'''%'%d-%m-%Y'%'''
SET DateFormat2 TO $'''%'%m-%d-%Y'%'''
@@copilotGeneratedAction: 'False'
Scripting.RunPythonScript PythonCode: $'''from datetime import datetime, timedelta
def get_previous_month_last_date():
today = datetime.today()
first_day_of_current_month = today.replace(day=1)
last_day_of_previous_month = first_day_of_current_month - timedelta(days=1)
# Format the date as dd-mm-yyyy
formatted_date = last_day_of_previous_month.strftime(\"%DateFormat1%\")
return formatted_date
# Example usage
previous_month_last_date = get_previous_month_last_date()
today_date = datetime.today().strftime(\'%DateFormat2%\')
output_string = \"Today\'s date is {}, last previous month last day was {}\".format(today_date, previous_month_last_date)
#print(output_string)
print(previous_month_last_date)
''' ScriptOutput=> PythonScriptOutput
Display.ShowMessageDialog.ShowMessage Message: PythonScriptOutput Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: True ButtonPressed=> ButtonPressed
Just copy and paste, easy peasy 😉
Please let me know if it works, happy automation!,
If I have addressed your inquiry successfully, kindly consider marking my response as the preferred solution. If you found my assistance helpful, a 'Thumbs Up' would be greatly appreciated.
Additionally, I offer specialized consultancy and development services leveraging PAD. If you're interested in exploring these services further, feel free to DM me, and we can initiate a discussion.
Finally, here is my LinkedIn Profile if you want to follow or connect with me.
Kind regards,
Will SG
Managing Director & Automation Lead
RAMS CR (Recruitment & Automation)