Program my microwave oven
JavaScript

var x = /(\d+):(\d\d)/.exec('&lt;time here&gt;');
x[1] === '0' ? +x[2] + 'S' :
x[1] &lt; 4 &amp;&amp; x[2] === '00' ? (
    x[1] === '1' ? '+' :
    x[1] === '2' ? '++' : '+++') :
x[2] &lt; 40 ?
    (x[1] - 1 ? x[1] - 1 : '') + '' + (6 + +x[2][0]) + x[2][1] + 'S' :
x[1] + x[2] + 'S'