I want to accept date in dd-MM-yyyy
format using textbox I have used ajax calendar also.
DateTime.ParseExact(txtDate.Text,"dd-MM-yyyy",null)
and
Convert.ToDateTime(txtDate.Text)
are both throwing exception:
string was not recognized as valid datetime.
I know when I will change my system dateformat which is currently MM-dd-yyyy
to dd-MM-yyyy
, it will start recognizing it but what is solution when I will publish it on server.
So is there any solution to parse it for current format ?