What is the best way to convert string to date in C# if my incoming date format is in YYYYMMDD
Ex: 20001106
Date() Function. as. Date() function in R Language is used to convert a string into date format.
Use DateTime.ParseExact(). Something like:
string date = "20100102"; DateTime datetime = DateTime.ParseExact(date, "yyyyMMdd", CultureInfo.InvariantCulture);
DateTime.TryParseExact(myDateString, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None, out myDateVar )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With