Best way to work with time series?

Is there a preferred class or timeline method in PHP? The main functionality I'm interested in is checking if the date is within the time span or generates timestamps for the lower and upper limits.

+3
source share
5 answers

use unix timestamp. If this is mysql data, you can save timestamps as if you could not then convert mysql datetimes to unix timestamps.

There is a lot of documentation on functionality related to this on php.net, but it's all relatively simple and easy to use.

Good luck.

+5
+3

unix,

if($time > $lower && $time < $upper)
  echo $time is inside bounds
+1

( , ) "Span" .

: Span, . : January = Span (1/1, 31/1) = Span (1/1, 1/2 (,....

+1

Definitely a Unix timestamp if your flights never cross its borders (1970/01/01 - 2037/03 / xx). If you never need to know the span (how many days are between 2009/03/05 and 2009/08/22?), Then strings in the format YYYYMMDDHHMMSS (or in other similar formats) work just as easily to determine if the data time between two other datetime values.

0
source

Source: https://habr.com/ru/post/1716232/


All Articles