I am trying to keep my calendar displays the date which every the user picks. and now my"{{date}}" is in the format like 2016-01-11
. Buy it is keep showing one day before the day I picked. I want it displays like mm/dd/yyyy
.
I am thinking that I have to convert my date format from 2016-01-11
to 01/11/2016
but how to accomplish that ?
$(function(){
$("#datepicker").datepicker({
onSelect:function(dateText, inst){
var day = $.datepciker.formatDate("yy-mm-dd",new Date(dateText));
$(location).attr("href","/report_date/" + day + "/");
}
})
$("#datepicker").datepicker("setDate", new Date("{{date}}"));
})
All my directories are named like 2016-10-11, thats why i am using yy-mm-dd