I have variable of a type DateTime objApplicationSummaryInfo.AdmissionDate. I am trying to assign a value, such as
objApplicationSummaryInfo.AdmissionDate = DateTime.ParseExact(
TextBox3.Text.ToString(), "dd/mm/yyyy", null);
But when i am assigning a value like 27/09/2012to a textbox3, the variable objApplicationSummaryInfo.AdmissionDate takes a value 1/27/2012 12:00:09. The format as well as the date comes back incorrect.
What possible code am I missing and what can be an alternate solution. Thanks for assistance.
mmis minutes.MMis monthsCustom Date and Time Format Strings
Your code should be:
You will also need to set the culture:
Otherwise it will use the culture of the machine running the code.