Convert string in dateTime and back

Hello all.
I have string variable with date “17.10.2021” i need to conver it to MM.dd.yyyy format, but variable must remain a string variable.

Stringvar=Date.parse(“17.10.2021”).to string(“MM.dd.yyyy”)

Error “String was not recognized as a valid DateTime”

Use like this


You can do like this :
Date1=Date1.Substring(3,2)+"."+ Date1.Substring(0,2)+"."+ Date1.Substring(6,4)
Date1=Cdate(Date1.Substring(3,2)+"/"+ Date1.Substring(0,2)+"/"+ Date1.Substring(6,4)).ToString("MM.dd.yyyy)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.