Convert string into Datetime

I am getting input as string format “06232021” and how will i convert this into datetime like “06/23/2021”

kindly assist!

@Swati_Verma
Welcome to the forum
grafik
Line 1 is parsing the string into a DateTime
Line 2 is parsing it into a dateTime and reformats it as requested

DateTime.ParseExact("06232021","MMddyyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("MM/dd/yyyy")
1 Like

Thankyou so much, it worked :slight_smile:

Perfect. Happy that it is running. May we ask you to close the topic after final testing. So other researchers can easy defined solved cases. Thanks

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