-1

I'm using datetime picker where I'm getting date in format like

2017-02-07 10:05

how can I trim this to use only HH:mm.

p.s. I dont want to change date format on datetime picker initialization

user1765862
  • 13,635
  • 28
  • 115
  • 220

1 Answers1

1

Example one:

var d = new Date("2017-02-07 10:05");
console.log(d.getHours() + ":" + d.getMinutes());

Example two:

"2017-02-07 10:05".split(" ")[1]
Unamata Sanatarai
  • 6,475
  • 3
  • 29
  • 51
  • Please allow this to be closed as duplicate. It is not rocket science - your second example was already commented 5 minutes ago – mplungjan Feb 07 '17 at 08:55