Here is the datepicker:
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/humanity/jquery-ui.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript">
var $ = jQuery.noConflict();
$(function () {
$("[id$=txtExpDate]").datepicker({
//dateFormat: 'DD, d MM, yy',
// dateFormat: 'mm-dd-yy',
//buttonImageOnly: true,
//buttonImage: 'http://jqueryui.com/demos/datepicker/images/calendar.gif'
});
});
$(function () {
$("[id$=txtManDate]").datepicker({
//dateFormat: 'DD, d MM, yy',
// dateFormat: 'mm-dd-yy',
//buttonImageOnly: true,
//buttonImage: 'http://jqueryui.com/demos/datepicker/images/calendar.gif'
});
});
</script>
Here is the code for convert:
DateTime dt2 = Convert.ToDateTime(txtManDate.Text);
DateTime dt3 = Convert.ToDateTime(txtExpDate.Text);
The server database i am using for insert value..this working very well in local code...but not working in server.
Error is:
String was not recognized as a valid DateTime.
What should i do??
I have already tried:
var manDate = DateTime.ParseExact(txtManDate.Text, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture);
DateTime dt2 = Convert.ToDateTime(manDate);
var expDate = DateTime.ParseExact(txtExpDate.Text, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture);
DateTime dt3 = Convert.ToDateTime(expDate);
But still the same error..any suggestion??
Client and server culture? If server is en and client it you must set your date in yyyy-MM-dd
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.