I\'m trying to find the first day of the month in python with one condition: if my current date passed the 25th of the month, then the first date variable will hold the first da
You can use dateutil.rrule:
In [1]: from dateutil.rrule import * In [2]: rrule(DAILY, bymonthday=1)[0].date() Out[2]: datetime.date(2018, 10, 1) In [3]: rrule(DAILY, bymonthday=1)[1].date() Out[3]: datetime.date(2018, 11, 1)