I have a string of datetime that looks like this:
2017-04-17 18:26:03
I can use javascript to reformat and shorten it like so:
var input = '2017-04-17 18:26:03';
var result = input.replace(/^(\d+)-(\d+)-(\d+)(.*):\d+$/, '$3/$2/$1');
console.log(result);
/////Prints This: 17/04/2017///
Now, I need to make it even shorter like this:
17/04/17
Could someone please advice on this?
Any help would be appreciated.
EDIT: I don't want to use anything like moment.js or any other library as it is overkill.