Extract time from moment js object
Solution 1:
If you read the docs (http://momentjs.com/docs/#/displaying/) you can find this format:
moment("2015-01-16T12:00:00").format("hh:mm:ss a")
See JS Fiddle http://jsfiddle.net/Bjolja/6mn32xhu/
Solution 2:
You can do something like this
var now = moment();
var time = now.hour() + ':' + now.minutes() + ':' + now.seconds();
time = time + ((now.hour()) >= 12 ? ' PM' : ' AM');
Solution 3:
Use format
method with a specific pattern to extract the time.
Working example
var myDate = "2017-08-30T14:24:03";
console.log(moment(myDate).format("HH:mm")); // 24 hour format
console.log(moment(myDate).format("hh:mm a")); // use 'A' for uppercase AM/PM
console.log(moment(myDate).format("hh:mm:ss A")); // with milliseconds
<script src="https://momentjs.com/downloads/moment.js"></script>