var dateG = new Date(dateN.replace(/(\d+).(\d+).(\d+)/, "$3-$2-$1"));
var s='31.11.2013'; alert(s.replace(/^(\d{2}).(\d{2}).(\d{4})/,'$3-$2-$1'))