Richard Stenstierna Richard Stenstierna - 11 months ago 153
Javascript Question

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';
}
},


Any ideas on how to change it?

Thanx

Answer Source

Have you read the docs?

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.