Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
function timeconvert(ds){
    var D, dtime, T, tz, off,
        dobj = ds.match(/(-?\d+)|([+-])|(\d{4})/g);
    T = parseInt(dobj[0], 10);
    tz = dobj[1];
    off = dobj[2];
    if (off) {
        off = (parseInt(off.substring(0, 2), 10) * 3600000) + (parseInt(off.substring(2), 10) * 60000);
        if(tz == '-') off *= -1;
    }
    else off= 0;
    return new Date(T += off).toUTCString();
}
console.log(timeconvert("Date(-124054000000+0300)"));
console.log(timeconvert('Date(1361145600000)+0000'));
console.log(timeconvert("Date(0+0300)"));
console.log(timeconvert("Date(-2+0200)"));
console.log(timeconvert("Date(-860000000000+1100)"));
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
rmwluxpro
0viewers