I have changed format to dd-mm-yy
in backend of page, i want to save date in'dd-mm-yy' format e.g.'23-02-2015' in database.and retreieve it in this format, i am using datetime picker in the text field...i changed the format of date picker to my 'dd-mm-yyyy' but its not saving data in that format and cause the below error
String was not recognized as a valid DateTime.
Any suggestions?
First , why aren't you sending datetime object ?
If you can't(!) , well ,
If your datetime object id
dt
so dodt.ToString("yyyy-MM-ddTHH':'mm':'sszzz", DateTimeFormatInfo.InvariantInfo)
This will be a valid iso datetime string.
The only truly safe formats for date/time literals in SQL Server, at least for DATETIME and SMALLDATETIME, are: