String to datetime

Hello! How can I convert a string for example “20180730” to 07/30/2018 as a datetime type?

 DateTime.ParseExact("20180730", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture)
 [07/30/2018 00:00:00]
 DateTime.ParseExact("20180730", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).GetType
 [System.DateTime]
 DateTime.ParseExact("20180730", "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture).toString("MM/dd/yyyy")
 "07/30/2018"
1 Like

Like a charm! Thank you!

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