How can I convert the BST date string to Javascript date object?
The follwing code gives me error for BST but works for other timezone
var data=\'Tue Apr
Putting these together
var timezone_map = {
'BST': 'GMT+0100'
};
function re_order(str) {
var re = /^(\w+) (\w+) (\d\d) (\d\d:\d\d:\d\d) (\w+) (\d\d\d\d)$/;
return str.replace(re, function ($0, day, month, date, time, zone, year) {
return day + ' ' + month + ' ' + date + ' ' + year + ' ' + time + ' ' + (timezone_map[zone] || zone);
});
}
new Date(re_order('Tue Apr 28 16:15:22 BST 2015'));
// Tue Apr 28 2015 16:15:22 GMT+0100 (GMT Daylight Time)