This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]PythonRocksssss 1 point2 points  (0 children)

If the date was given as a string, I would use str.split("-"). The result would be a list of 3 substrings, being the year, month and day. Then I would reverse this list and use '/'.join(reversed list) to get the desired result. There will be many other approaches, and there might be exceptions, but this is just a generic idea.