php的date对象与javascript的Date对象区别

php中time()返回的时间戳是以秒为单位;

javacsript中的getTime()返回的时间是以毫秒为单位;

 

 php-date:

<?php

echo date("y-m-d"); 

?> 

 

javascript-date:

<script>

var d=new Date();

d.getFullYear();

d.getMonth();

d.getDate(); 

</script> 

 

好像php的date对象返回的时间戳是秒,javascript的Date对象返回的时间戳是毫秒; 

posted @ 2016-04-07 15:13  夜深人静123  阅读(255)  评论(0编辑  收藏  举报