Read the documentation.
Date.now(), Date#getTime(), etc return the number of milliseconds
since epoch. Whereas php's time() returns seconds. Hence the 3 digit
difference.
Math.round(Date.now() / 1000)
That converts from ms to s.
On 05/04/2013 09:56 μμ, Tolgay Toklar wrote:
> Thanks for answers.
>
> But there is a problem: Php time() function returns 10 digit
> number.Javascript Date.now() function returns 13 digit number.How
> can I resolve this problem ? I can't do process on numbers.
>
> 5 Nisan 2013 Cuma 18:56:49 UTC+3 tarihinde Tolgay Toklar yazdı:
>
> Hi
>
> How can I get server timestamp in nodejs ? (Like a php time()
> function)
>
> -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>
>
>
>
You received this message because you are subscribed to the Google
> Groups "nodejs" group. To post to this group, send email to
> [email protected] To unsubscribe from this group, send email
> to [email protected] For more options, visit
> this group at http://groups.google.com/group/nodejs?hl=en?hl=en
>
> --- You received this message because you are subscribed to the
> Google Groups "nodejs" group. To unsubscribe from this group and
> stop receiving emails from it, send an email to
> [email protected]. For more options, visit
> https://groups.google.com/groups/opt_out.
>
>
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.