mardi 12 décembre 2017

Pattern between database Dates

The purpose of what I want to make is that a user has the option to repeat some action, once that action is done there will be a record with the date of the action set in the database, what I want to do is find the pattern if there is one, of a specific action a user does(every year, every week, etc)

So if the db returns me that action A was completed in the following:

2015-01-25 //Y-M-D format
2016-01-29
2017-02-04

I want this to be recognized as a yearly pattern.

But if action B is

2015-01-25
2016-01-29
2016-02-04
2017-01-24

This should not be seen as a pattern.

What I don't know is how what I am looking to do is called, and how to find some methods to implement it. If you could point me some techniques or even how what I am trying to do is called so I can look it up on my own. If someone could provide a sample code(in PHP) I would be even more obliged.

Aucun commentaire:

Enregistrer un commentaire