Ok. this question usually come to my mind and always I prefer using millis because I think that is the easiest way to store and get the time in database.<p>But some of my friends prefer using timestamp.<p>So I just wanted to know, What is the best practise for storing time in database ?<p>When choosing between timestamp and millis which one you prefer using and why?
We have a very similar problem. We keep timestamps in numeric form as "epoch nanos" (nanoseconds from 1970-01-01 00:00) We are using PostgreSQL as the database, and I would very much like to use the native type (TIMESTAMP) [1], but PostgreSQL only keeps TIMESTAMP columns to microseconds, not nanoseconds. :-(<p>Using the native DBMS types allows use of native DBMS time and interval functionality, unless you like doing it yourself.<p>See also [2]<p>[1] <a href="https://www.postgresql.org/docs/9.6/static/datatype-datetime.html" rel="nofollow">https://www.postgresql.org/docs/9.6/static/datatype-datetime...</a><p>[2] <a href="http://stackoverflow.com/questions/409286/should-i-use-field-datetime-or-timestamp" rel="nofollow">http://stackoverflow.com/questions/409286/should-i-use-field...</a>