I use this new Date.getTime() to get current timestamp in jquery. It gave me value 1380796448330
But when I checked with PHP time() function it gave me :1380796567
Why is there a difference in length of both values?
I use this new Date.getTime() to get current timestamp in jquery. It gave me value 1380796448330
But when I checked with PHP time() function it gave me :1380796567
Why is there a difference in length of both values?
The JavaScript Date.getTime method returns the time since start of Unix Epoch in milliseconds and PHP time() function returns it in seconds.
So if you want to use the timestamp from client-side in PHP you should divide it by thousand.
And vice versa if you want to use the timestamp retrieved in PHP at the client side (e.g. to pass it into the Date constructor) you should multiply it to thousand.
Hi difference is mentioned here take look (Counted Timestamp blog) and will help u ... http://cw.tactileint.com/++Dates_and_Times/JavaScript,PHP