Javascript Data Type How to - Parse String as 16 Jan 2014 10:56:24 am PST to Date








Question

We would like to know how to parse String as 16 Jan 2014 10:56:24 am PST to Date.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!--from  w  w w .jav a  2  s  .  com-->
    var d = new Date("16 Jan 2014 10:56:24 am PST");
    document.writeln(d);
}
</script>
</head>
<body>
</body>
</html>

The code above is rendered as follows: