On Dec 7, 2012, at 12:32 AM, Dmitriy Fot 
<[email protected]<mailto:[email protected]>> wrote:

- Is it right decision to use an array for the timestamp, or it is
better to use a long?

Depends what you’ll be using it for. The array you have is great if you’ll be 
doing a lot of tests based on the components of the date, i.e. all the posts 
from November 2012. If you just need to compare times or look at the interval 
between two times, a numeric timestamp is best (at the expense of not being 
directly human-readable.) A string timestamp is more compact than an array and 
can be converted into either a number or components by the JS Date class, 
although the conversion is somewhat expensive.

(Another thing to consider about timestamps is whether you need to remember the 
time zone or not. For most purposes you can just pre-convert everything to UTC, 
but for some queries you might want to know the local time, i.e. “what time of 
day do people post most often?”)

—Jens

Reply via email to