It's worth noting that strtotime() accepts words like "today" as a valid input, so you don't need to put a call on date () if all you need is today's date. You can simply use strtotime('today'); .
Think about it, a simple call to time(); will also give you the current timestamp.
But in order to answer this question, you need to consider that dmY and mdY ambiguous - if the day of the month is less than the 12th, it is impossible to determine which of these two date formats was intended, therefore PHP accepts only one of them (I believe that it uses m / d / Y if you have slashes, but for dots or dashes it assumes dmY.
If you use strtotime () to convert date formats, etc., there is almost certainly the best way to do this. But if you really need to do this, use the 'Ym-d' format because it is much more versatile.
On the other hand, if you accept data entry from your users and think that strtotime () will deal with anything that would be thrown at it, then, unfortunately, you are mistaken; strtotime () has some pretty big limitations from which you found it. But there are others. If you plan on using strtotime () for this kind of thing, you also need to do extra processing. There may also be more efficient options, such as using the front-end Javascript control to make it easier for your users without relying on strtotime () to figure out what they mean.
source share