Hello Reader's If your website getting the dates in different different date formats. Then you can see all the date formats that are valid in JS.
Let's see the below date formats in JS.
var d = new Date("2015-03-25");
var d = new Date("2015-03");
var d = new Date("2015");
var d = new Date("2015-03-25T12:00:00");
var d = new Date("Mar 25 2015");
var d = new Date("25 Mar 2015");
var d = new Date("Jan 25 2015");
var d = new Date("2015, JANUARY, 25");
var d = new Date("03/25/2015");
var d = new Date("03-25-2015");
var d = new Date("2015/03/25");
var d = new Date("Fri Mar 25 2015 09:56:24 GMT+0100 (Tokyo Time)");
var d = new Date("Wed Mar 25 2015 09:56:24 GMT+0100 (W. Europe Standard Time)");
So all the date formats above are correct and you can use them in order to sort or compare with another date. Even you can convert them into Unix time easily.
0 Comment(s)