-4

I am trying to convert my date object to mm/dd/yy hh/mm

   newDateObj = new Date(dateString).toLocaleString(); 

Output is 12/7/1913, 1:31:52 PM but i dont want the seconds.

Nah
  • 1,690
  • 2
  • 26
  • 46
early_ninja
  • 109
  • 1
  • 2
  • 9

2 Answers2

0

You can use MomentJS and combine moment("1913-12-07T17:41:52").format('L'); // 12/07/1913 with moment("1913-12-07T17:41:52").format('LT'); // 5:41 AM

DevEng
  • 1,114
  • 2
  • 15
  • 29
0

I got it working without momentum

   var options = {month: '2-
   digit', day: '2-digit', year: '2-digit',hour: '2-digit', minute:'2-digit'};

   newDateObj= new Date(dateString).toLocaleString([], options );

Output is 12/7/1913, 1:31:52 PM

early_ninja
  • 109
  • 1
  • 2
  • 9