Could do it with datetime and using strftime() and strptime() Format Codes
I would suggest pendulum ,then it easier and special care has been taken to ensure
I would suggest pendulum ,then it easier and special care has been taken to ensure
timezones
are handled correctly.>>> import pendulum >>> >>> d = '2022-03-16' >>> date = pendulum.parse(d) >>> date DateTime(2022, 3, 16, 0, 0, 0, tzinfo=Timezone('UTC')) >>> print(date) 2022-03-16T00:00:00+00:00