V
V
Vitaly2017-02-26 16:34:09
Algorithms
Vitaly, 2017-02-26 16:34:09

Fast (preferably very fast) timestamp analysis, help me out!?

Hello.
Guys, hello everyone. Faced with the task when there are many many timestamps, you need to quickly distribute them by day. I understand that after getting a month, a year, a day, this is solved very simply. But then there was the issue of speed.
Remembering from the past that by multiplying the IP and the subnet mask in binary mode I got the subnet value, I thought, maybe there are some similar mathematical algorithms for the timestamp? I would be grateful for any directions and ideas.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
vkdv, 2017-02-26
@vshvydky

Maybe I did not understand the problem, but I do not see it, if the date is known in advance, then betwen.
If you want to group in the selection by days, you can divide by a day (60 * 60 * 24), then
you will get the ordinal numbers of the day from the current date in the opposite direction, and in PHP, if you need to get the date, use the built-in functions and bring it to the form date () - index day

_
_ _, 2017-02-26
@AMar4enko

In months, a different number of days and years are leap years, in contrast to the bytes in the IP address.

D
d-stream, 2017-02-26
@d-stream

Use standard functions to convert timestamp to date/days/years at the library or database level.
The big guys there have long and successfully (because unsuccessful products have already been forgotten) optimized everything and even provided for leap years, extra seconds and other tricks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question