I have a SQL server stored procedure and I am trying to replicate it using python. One of the things I am trying to replicate is the following function:
DECLARE @Anchor_DT as DATE =EOMONTH(Getdate(),-1);
Here is what I have tried in Python3:
import datetime
datetime.date (2000, 3, 1) - datetime.timedelta (days = 1)
Output:
datetime.date(2000, 2, 29)
The thing is, I have to enter the date (200,3,1). I want to be able to pick up the current date and output the End of month. Here is what I tried but to no avail:
import datetime
datetime.date.now() - datetime.timedelta (days = 1)
Any suggestions or recommended solutions?