I have a string that comes in the format name = "1/2/2021"
, how can I convert this string to the format newName = "2021-2-1"
original = name day = original[0] month = original[2] year = original[4:8] combination = year + "-" + month + "-" + day
I have tried using this but brings wrong values when date or month changes to more than 2 characters
https://stackoverflow.com/questions/65546132/convert-1-2-2021-to-2021-2-1 January 03, 2021 at 10:30AM
没有评论:
发表评论