convert military time to standard time javascript code example
Example 1: convert military time to standard time javascript
function convert(input) {
return moment(input, 'HH:mm:ss').format('h:mm:ss A');
}
console.log(convert('20:00:00'));
console.log(convert('08:00:00'));
console.log(convert('16:30:00'));
Example 2: convert military time to standard time javascript
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.js"></script>