Monday, 27 November 2017

Java Script Date Operation

Java Script Date Operation


Convert dd/mm/yyyy date to yyyy/mm/dd

Java Script support date in many format except dd/mm/yyyy . So if you are working on a project which has date as in dd/mm/yyyy format then you will need to change it mm/dd/yyyy for further date related operations.

Following code will change dd/mm/yyyy date to mm/dd/yyyy date format



var date = "03-11-2014";
var myDate = date.split("-").reverse().join("-");

alert(myDate)