convert 12 hour format to 24 hour format in js code example Example: javascript conver time into 24 hour format var dt = moment("12:15 AM", ["h:mm A"]).format("HH:mm");