Created
October 2, 2015 03:40
-
-
Save skrosoft/56ad54fe29bf11074a1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function processData(input) { | |
var is_pm = input.indexOf('PM') != -1; | |
var s = input.replace('PM', '').replace('AM', '').split(':'); | |
if (is_pm && s[0] != '12') s[0] = parseInt(s[0]) + 12; | |
if (!is_pm && s[0] == '12') s[0] = '00'; | |
process.stdout.write(s[0] + ':' + s[1] + ':' + s[2]); | |
} | |
process.stdin.resume(); | |
process.stdin.setEncoding("ascii"); | |
_input = ""; | |
process.stdin.on("data", function (input) { | |
_input += input; | |
}); | |
process.stdin.on("end", function () { | |
processData(_input); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment