Hello,
How can I send last day of previous month in a Shortcut ?
In date and time I do not find a way to send last day of previous month.
I can send first day of previous month with this formatting 01/MM/yyyy
DAY TIME CALCULATION: LAST DAY OF PREVIOUS MONTH
Code: Select all
TDate := A_YYYY A_MM "01" ; Start Date of Current Month
TDate += -1, D ; End Date of Previous Month
FormatTime, fileDate, %TDate%, dd.MM.yyyy
Send, %fileDate%
To get the last day of the previous month in Shortcuts, try this simple approach:
Get Current Date
Adjust Date
Subtract the number of days equal to the current day (Get Day of Date, then Adjust Date by -[that number] days). This brings you to the last day of the previous month.
Format Date
Format it as dd/MM/yyyy to send.
I used a similar date trick earlier while doing my [SASSA Status Check][/https://srd-sassa-gov.co.za/] – Shortcuts really makes quick calculations like this easy.
Get Current Date
Adjust Date
Subtract the number of days equal to the current day (Get Day of Date, then Adjust Date by -[that number] days). This brings you to the last day of the previous month.
Format Date
Format it as dd/MM/yyyy to send.
I used a similar date trick earlier while doing my [SASSA Status Check][/https://srd-sassa-gov.co.za/] – Shortcuts really makes quick calculations like this easy.