If you are supplying a UTC timestamp and want seconds since 1/1/1970, then:
[...]
Edit
Revisited my original answer and didn't like it, the following is better:
// Given an ISO8601 UTC timestamp, or one formatted per the OP,
// return the time in seconds since 1970-01-01T00:00:00Z
function toSecondsSinceEpoch(s) {
s = s.split(/[-A-Z :\.]/i);
var d = new Date(Date.UTC(s[0], --s[1], s[2], s[3], s[4], s[5]));
return Math.round(d.getTime()/1000);
}
Note that the string in the OP isn't ISO8601 compliant, but the above will work with it. If the timestamp is in the local timezone, then:
// Given an ISO8601 timestamp in the local timezone, or one formatted per the OP,
// return the time in seconds since 1970-01-01T00:00:00Z
function toSecondsSinceEpochLocal(s) {
s = s.split(/[-A-Z :\.]/i);
var d = new Date(s[0],--s[1],s[2],s[3],s[4],s[5]);
return Math.round(d.getTime()/1000);
}
If decimal seconds should be accommodated, a little more effort is required to convert the decimal part to ms.