I have an string, like YYYY/MMM/DD and I want to convert it into YY/MM/DD formart.
In short, I want to replace repeated characters more than 2.
Example 01:- YYYY/MMM/DD -> YY/MM/DD
Example 02 :- MMM/YYYY/DD -> MM/YY/DD
Please help me out.
try to use this
var date = new Date();
var datestr = ('0' + date.getDate()).substr(-2, 2) + '/' + ('0' + date.getMonth()).substr(-2, 2) + '/' + ('0' + date.getFullYear()).substr(-2, 2);
alert(datestr);