How do i extract the time using moment.js?
JavaScript
x
2
1
"2015-01-16T12:00:00"
2
It should return “12:00:00 pm”. The string return will be passed to the timepicker control below.
JavaScript
1
2
1
http://jdewit.github.com/bootstrap-timepicker
2
Any idea?
Advertisement
Answer
If you read the docs (http://momentjs.com/docs/#/displaying/) you can find this format:
JavaScript
1
2
1
moment("2015-01-16T12:00:00").format("hh:mm:ss a")
2
See JS Fiddle http://jsfiddle.net/Bjolja/6mn32xhu/