You can try the following:
$(document).ready(function() { var userDate = '04.11.2014'; var from = userDate.split("."); var f = new Date(from[2], from[1], from[0]); var date_string = f.getFullYear() + " " + f.getMonth() + " " + f.getDate(); console.log(date_string); });
Alternatively, I would look at Moment.js. It would be easier to deal with dates:
$(document).ready(function() { var userDate = '04.11.2014'; var date_string = moment(userDate, "DD.MM.YYYY").format("YYYY-MM-DD"); $("#results").html(date_string); });
MOMENT.JS DEMO: FIDDLE
source share