There is no need for UTC and therefore remove it.
Basically what you're looking for is (converting to 12 hrs time format)
pad(d.getHours() > 12
? d.getHours() - 12 : d.getHours())
Complete Code:
function ISODateString(d) {
function pad(n) {
return n < 10 ? '0' + n : n
}
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-'
+ pad(d.getDate()) + ' ' + pad(d.getHours() > 12
? d.getHours() - 12 : d.getHours())
+ ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds())
}
Result:
input: 2013-08-08 14:30:59
output: 2013-08-08 03:00:59 //Since you increased 30 mins