Does anyone know how to parse date string in required format dd.mm.yyyy
?
Use Date object:
var time = Date.parse('02.02.1999');
document.writeln(time);
Give: 917902800000
refs: http://momentjs.com/docs/#/parsing/string/
If you use moment.js, you can use "string" + "format" mode
moment(String, String);
moment(String, String, String);
moment(String, String, Boolean);
moment(String, String, String, Boolean);
ex:
moment("12-25-1995", "MM-DD-YYYY");
I'v been used following code in IE. (IE8 compatible)
var dString = "2013.2.4";
var myDate = new Date( dString.replace(/(\d+)\.(\d+)\.(\d+)/,"$2/$3/$1") );
alert( "my date:"+ myDate );