1function convert(input) {
2 return moment(input, 'HH:mm:ss').format('h:mm:ss A');
3}
4
5console.log(convert('20:00:00'));
6console.log(convert('08:00:00'));
7console.log(convert('16:30:00'));
1<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js"></script>