Skip to main content
saved 1 byte
Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

##Javascript (ES6), 9393 92 bytes

t=>((t=1440+evalt=eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)'+720')))/60%24|0)+':'+(t/10%6|0)+t%10

###Test cases

let f =
t=>((t=1440+evalt=eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)'+720')))/60%24|0)+':'+(t/10%6|0)+t%10

console.log(f("08:50 UTC-06:00")); //  2:50
console.log(f("09:42 UTC+05:45")); // 15:27
console.log(f("06:42 UTC+13:00")); // 19:42
console.log(f("02:40 UTC-10:00")); // 16:40
console.log(f("17:25 UTC+09:00")); //  2:25

##Javascript (ES6), 93 bytes

t=>((t=1440+eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)')))/60%24|0)+':'+(t/10%6|0)+t%10

###Test cases

let f =
t=>((t=1440+eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)')))/60%24|0)+':'+(t/10%6|0)+t%10

console.log(f("08:50 UTC-06:00")); //  2:50
console.log(f("09:42 UTC+05:45")); // 15:27
console.log(f("06:42 UTC+13:00")); // 19:42
console.log(f("02:40 UTC-10:00")); // 16:40
console.log(f("17:25 UTC+09:00")); //  2:25

##Javascript (ES6), 93 92 bytes

t=>((t=eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)+720')))/60%24|0)+':'+(t/10%6|0)+t%10

###Test cases

let f =
t=>((t=eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)+720')))/60%24|0)+':'+(t/10%6|0)+t%10

console.log(f("08:50 UTC-06:00")); //  2:50
console.log(f("09:42 UTC+05:45")); // 15:27
console.log(f("06:42 UTC+13:00")); // 19:42
console.log(f("02:40 UTC-10:00")); // 16:40
console.log(f("17:25 UTC+09:00")); //  2:25

Source Link
Arnauld
  • 197.6k
  • 20
  • 179
  • 649

##Javascript (ES6), 93 bytes

t=>((t=1440+eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)')))/60%24|0)+':'+(t/10%6|0)+t%10

###Test cases

let f =
t=>((t=1440+eval(t.replace(/.*?(.)?(..):(..)/g,'$1($2*60+$3)')))/60%24|0)+':'+(t/10%6|0)+t%10

console.log(f("08:50 UTC-06:00")); //  2:50
console.log(f("09:42 UTC+05:45")); // 15:27
console.log(f("06:42 UTC+13:00")); // 19:42
console.log(f("02:40 UTC-10:00")); // 16:40
console.log(f("17:25 UTC+09:00")); //  2:25