I want to generate a list of length n with random datetime strings in Python within a range. I had asked a similar question before, but I did not use the correct format for datetime.What is the best way to achieve this? Answer Modifying the answer here for your format: https://stackoverflow.com/a/553448/7942856 Outputs: Then if you want the text ISO format,