Reputation: 1441
I have date string like Fri, 15 Nov 2013 09:00:00 -0600
in JavaScript(sent by server PHP). I need to parse this and get the timezone offset '-0600'.
Is there any easy way to get the timezone offset from this string?
Thanks
Upvotes: 2
Views: 1386
Reputation: 771
var reg_exp = /(-|\+)\d{4}/,
timezone_offset = reg_exp.match("Fri, 15 Nov 2013 09:00:00 -0600")[0];
Upvotes: 0
Reputation: 14827
var str = "Fri, 15 Nov 2013 09:00:00 -0600"
var output = str.split(' ').pop();
Demo: http://jsfiddle.net/D7c28/
Upvotes: 1