c# - datepicker return wrong dateformat(mm/dd/yyyy) at controller -
in mvc application have utilize datepicker , have code
$("#startdate").datepicker({ changemonth: true, changeyear: true, dateformat: 'dd/mm/yy', dateonly: true, }); $("#startdate").datepicker('option', 'dateformat', 'dd/mm/yy');
on click event
function searchfine() { var startdate = $("#startdate").val(); var enddate = $("#enddate").val(); var pathname = window.location.pathname; var virtualdir = pathname.split('/'); var directory = "/" + virtualdir[1] + "/managelibrary/managereports/finecollectionsreportbydate?startdate=" + startdate + "&&enddate=" + enddate; location.href = directory; }
but geting mm/dd/yyyy format
thanks .
possible solutions problem are:
verify if right value sent server using illustration firebug. have set right localisation in web.config? note asp mvc usesinvariantuiculture
when request, 11/03/2010 become nov 3. can test sending date 31/12/2010, datetime
equal default(datetime)
because can't parsed mm/dd/yyyy. post request, localisation of current thread used parse date string. solution: send date string, , parse datetime
in actionresult
. c# jquery asp.net-mvc
No comments:
Post a Comment