Comparing dates 'yyyy

Then I try to lớn compare them like this,

if (strtotime($now) Why does the code inside the IF statement never execute?


If you want to use MM/DD/YYYY format you need / separator.

Bạn đang xem: Comparing dates 'yyyy

Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.




I see you accepted answer but just to make sure you underst&. There are 2 cases that dates are parsed.

American - month/day/yearEuropean - day.month.year or day-month-year

The proper format for you is one of these:

Morover, lớn compare datatime it"s better lớn use object oriented solution & DataTime object. You can read more here.

Xem thêm: Phần Mềm 2 +2 Math For Kids


The case of strtotime() function is the most easy way to handle using the format as yyyy-mm-dd. This is normal format in db date. If you use this format help easy for compare two dates.

In Europe, in particulary in France,we also use this format with the slash separator :

Thanks for contributing an answer to Staông chồng Overflow!

Please be sure khổng lồ answer the question. Provide details & nói qua your research!

But avoid

Asking for help, clarification, or responding to other answers.Making statements based on opinion; baông xã them up with references or personal experience.

To learn more, see our tips on writing great answers.

Post Your Answer Disthẻ

By clicking “Post Your Answer”, you agree to lớn our terms of service, privacy policy và cookie policy

Not the answer you're looking for? Browse other questions tagged php date strtotime or ask your own question.

site thiết kế / biểu tượng logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev2021.3.3.38704