I want to convert string 2017-03-05 to Datetime object in c# in format yyyy-MM-dd
string startDate = \"2017-03-05\";
DateTime myDate = DateTime.ParseExact
When you parse your string to DateTime, it will have no format.
DateTime structure does not have any implicit format. It just have date and time values which is based on long field as Ticks. Format concept only applies when you try to get it's textual (aka string) representation of it. It is really important to understand the difference between a DateTime instance and it's formatted string representation.
So, if you wanna get a specific textual format of your DateTime, you will need to get it's string representation again.
string result = myDate.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);