I am getting the date-time
from the client like this:
Thu Mar 12 2020 00:00:00 GMT+0530 (India Standard Time)
I want to convert it into:
2020-03-12
How can I do that?
I am getting the date-time
from the client like this:
Thu Mar 12 2020 00:00:00 GMT+0530 (India Standard Time)
I want to convert it into:
2020-03-12
How can I do that?
I think you are looking for something like this:
import datetime
date_now = datetime.datetime.now().date()
print (str(date_now))
or
print(str(datetime.datetime.now().date().strftime('%Y-%m-%d')))
the output will be:
'2020-03-02'
For more information please look the docs.