How to convert a string to a DateTime object in C#? - Biz Tech

How to convert a string to a DateTime object in C#?

Listen
string input = "2022-03-18 14:30:00";
DateTime date = DateTime.ParseExact(input, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
Console.WriteLine(date);