Parse DateTime string in JavaScript

Azat picture Azat · Oct 16, 2009 · Viewed 221.7k times · Source

Does anyone know how to parse date string in required format dd.mm.yyyy?

Answer

Jonathan Fingland picture Jonathan Fingland · Oct 16, 2009

See:

Code:

var strDate = "03.09.1979";
var dateParts = strDate.split(".");

var date = new Date(dateParts[2], (dateParts[1] - 1), dateParts[0]);