-1

I wanted the output to be yyyy-mm-dd only, without the time. this is what i tried:

Begindate = datetime.strptime(Begindatestring, "%Y-%m-%d")
print(Begindate)

thank you

1 Answers1

0

Use datetime.strftime:

print(Begindate.strftime("%Y-%m-%d"))
Roman Pavelka
  • 3,736
  • 2
  • 11
  • 28