What is the best way to compare dates?
- How to string? "2012-04-29 23:00:01"
- how int? 1335726001
- another?
What is the best way to compare dates?
I would store them and compare as int. So, less memory is allocated, and comparison is faster, and, unlike lines, they can easily be converted to any desired format. However, @klopp said very correctly - it strongly depends on what you will do with them.
I think the time () function is simply not replaceable in this situation, firstly it creates int date value, secondly, you can always translate it into a normal (human) view, as well as calculate the difference between dates, even in negative values. Google - time PHP
Source: https://ru.stackoverflow.com/questions/199633/
All Articles