I want to convert a string to datatime. Here is my code:
DateTime? dt = null;
dt = DateTime.Parse(postdate[i]);
It works only for dd/mm/yyyy, not work for mm/dd/yyyy because on my computer the date format is set as dd/MM/yyyy in Control Panel.
So if I want to use the application always accept valid format mm/dd/yyyy, no matter the windows date format setting is. How to implement this in c# code?
I think this should work: