I want to convert
Tue Jul 12 2016 00:00:00 GMT+0100 (BST)
into
12/07/2016
Say I have d = Tue Jul 12 2016 00:00:00 GMT+0100 (BST). I tried
var a = d.getDate()+"/"+(d.getMonth()+1)+"/"+d.getFullYear();
But then I get 12/7/2016 instead of 12/07/2016
I could do
if(d.getMonth()<10){
var a = d.getDate()+"/0"+(d.getMonth()+1)+"/"+d.getFullYear();
But I don't like that and plus I will have the same problem when the day is less than 10. Whats the best way to get to my desired format. I just need it as a string for display in a view.