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