0

I am getting a big list of objects in this format:

[datetime.datetime(2020, 3, 5, 13, 59, 45, 624362, tzinfo=<UTC>), ... ]

I would like for each date in this list to be converted to a string looking like this:

['2020-03-05', ...]

Any suggestions?

1 Answer 1

3

[dt.date().isoformat() for dt in your_list_of_datetimes]

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, it worked.. can only accept your answer in 10 mins.. will do, have a good one

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.