Should I use the timestamp or the date of the storage date to display the dynamic time function?

advertisements

I want to create dynamic timeago funtion with jquery timeago but I can do it with php time() because it is same for every server and I can handle it easily.But I heard that it is not recomended to store timestamp(I get it from php time() function) it will be very high numbers in the 2038 and so on.

Also I watched facebook html codes I think they use timestamp also because I see this:

<abbr title="Sunday, July 01, 2016 at 12:24pm" data-utime="1468743808" class="timestamp livetimestamp">
<span class="timestampContent">about an hour ago</span></abbr>

data-utime it means they store timestamp?But why it is not recommended to store it?Is it true timestamp will be very high numbers in the future?


It does not matter about the year, db timestamp type will occupy the same amount of bytes. You can use in JS new Date().getTime() does in fact return a UTC value, so it is a really helpful way to store and manage dates in a way that is agnostic to localized times. For the given example above they are using numeric repressntation of Timestamp.