0
today1 = today.strftime("%d")

This print and give me 02 Similarly how can i find yesterday and day before yesterdays date with 0 as prefix for single digit So for yesterday the output will be 01 and for day before yesterdays the output will be 31

Yash
  • 1
  • 3

1 Answers1

0

You can also try this.

import datetime

today = datetime.date.today()-datetime.timedelta(days=1)
today

This should give result

2022-06-01

today.strftime("%d")

01

Tandin
  • 1
  • 3