PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Ok so this has been bugging me for sometime now. It seems if I am correct that any time you want to compare dates you have to do a mktime function. Why if I have a given date already, and can format it do i need to do a mktime function? Example: If I wanted to find out what yesterday was I could do this:
strtotime() will have trouble understanding certain formats because they aren't very uniform and can be interpreted in too many ways. "d M Y" is likely a good example of this, whereas "Y-m-d" works just fine.
So if I revise the input to strtotime to Y-m-d then that should solve some of the issues I am seeing? I really was just trying to get a feel for how other people calculate dates. It would seem to me that this is a common issue that people would come across.
That is how I have been working around this right now actually. But it just bugged me, why it was doing that. There have been some times where the sql query was so complex that it was hard to fit in the date diff function. Ie items come from 2 different sql servers and you are comparing dates.