Quick actions

cmd+k|ctrl+k

Navigation

Languages

converting into millatry time

Snippet info

Language

JavaScript

Visibility

public

Author

krishnakanth

Created

2022-08-21T13:01:33.722974Z

Updated

2022-08-21T13:07:25.898897Z

function processData(input) {
    //Enter your code here
    var hh = parseInt(input.substr(0, 2));
    var mmss = input.substr(2, 6);
    var pm = input.substr(8) === 'PM';
    var is12 = hh === 12;
    var res = (is12 ? (pm ? 12: 0):(pm ? hh + 12: hh));
    console.log('' + (res < 10 ? '0': '') + res + mmss);
} 

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
   processData(_input);
});
INFO