When to use UNIX_TIMESTAMP

1

For sure, we all work with dates, timestamp, among other forms and formats.

The UNIX_TIMESTAMP (the time in seconds since '1970-01-01 00:00:00' UTC so far) always ends up appearing slightly when we are looking for manipulations between that data type .

  • When is it effective to use UNIX_TIMESTAMP ?
  • Being numeric, would it be an advantage in writing / reading?
  • Is the advantage only for those working with multiple time zones?

In other words, briefly what are the pros and cons?

    
asked by anonymous 29.03.2018 / 12:42

1 answer

2

This information demonstrates the time passed since 1970. Therefore it can not be used to mark a point at any time, it can not be used to save dates and times in general. It is an internal information of the use of computers. It is considered that nothing a computer produced may have occurred before 1970. At least in Unixes it can not, so it need not be able to represent a number prior to this.

He is a number, his 0 score is 1970-01-01 00:00:00. So the 1 would be 1970-01-01 00:00:01 and at this time the timestamp has the number 1522323093, so this is the amount of seconds passed since the beginning of the year 1970. >

There are other forms of timestamp that do not follow this rule, I'm just talking about Unix, derivatives and any application that uses it.

There is an advantage in being numeric because it is manipulated binary and is very healing and very quick to calculate.

It has nothing to do with time zone. Any time point shape may or may not have time zone information. Usually it is recommended for most applications, but there are different cases, that the time is always UTC, that is, the universal time without indication of which spindle it is, therefore in Brazil the timestamp should be used with less two or less three hours depends on whether it is summer time or not. These rules may change, so universal time is better.

Then use it for logs and other forms of auditing, transaction control, event IDs generated within the computer, but do not use to store general time. Do not use to save birthdate or other events in history, do not even use to store a registration date because it is essentially an external information and could have been registered before computers exist.

In 2038 he will end his ability .

    
29.03.2018 / 13:33