Javascript Data Type How to - Get date in seconds








Question

We would like to know how to get date in seconds.

Answer


<!DOCTYPE html>
<html>
<body>
<script type='text/javascript'>
<!--from ww w  . j a v a  2  s .c  om-->
    var d1 = Date.parse('Wed Jun 20 19:20:44 +0000 2012')/1000;
    document.writeln(d1);

</script>
</body>
</html>

The code above is rendered as follows: