# moment.js 24h format

## moment.js 24h format

How do I display my time in 24h format instead of 12?
I am using moment.js.
I am pretty sure that these lines could have something to do with it.
meridiem : function (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? ‘pm’ : ‘PM’;
} else {
return isLower ? ‘am’ : ‘AM’;
}
},

How to change it?

### Solution 1:

It states

``````H, HH       24 hour time
h, or hh    12 hour time (use in conjunction with a or A)
``````

Thus, stating your time as `HH` will give you 24h format, and `hh` will give 12h format.

### Solution 2:

Try: `moment({ // Options here }).format('HHmm')`. That should give you the time in a 24 hour format.

### Solution 3:

Use `H` or `HH` instead of `hh`. See http://momentjs.com/docs/#/parsing/string-format/

### Solution 4:

``````moment("01:15:00 PM", "h:mm:ss A").format("HH:mm:ss")
**o/p: 13:15:00 **
``````

it will give convert 24 hrs format to 12 hrs format.

### Solution 5:

You can use

`````` moment("15", "hh").format('LT')
``````

to convert the time to 12 hours format like this `3:00 PM`

### Solution 6:

``````//Format 24H use HH:mm
let currentDate = moment().format('YYYY-MM-DD HH:mm')
console.log(currentDate)

//example of current time with defined Time zone +1
let currentDateTm = moment().utcOffset('+0100').format('YYYY-MM-DD HH:mm')
console.log(currentDateTm)``````
``<script src="https://momentjs.com/downloads/moment.js"></script>``