time()和Date.now()之间有什么区别

I have this value with PHP time() : 1454346117

And in same time with JavaScript Date.now() : 1454346117299

As you see in JavaScript i have 3 more digit in last. How to fix that i need same number?

Thank you

Use this in javascript:

Math.floor(Date.now() / 1000)

to get the same format

PHP: time

Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Date.now()

[R]eturns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.

To get seconds from miliseconds on javascript just divide by 1000, like this:

var seconds = new Date() / 1000;