我想比較兩個日期,但不幸的是,這不是通過將其轉換爲UNIX格式與strtotime
工作。我試圖比較日期到另一個日期。爲什麼strtotime不工作php
但是這種格式的工作:
if(strtotime("22-04-17") < strtotime("25-05-17")){
echo 'Date One is smaller than date two';
}
但很多時候,它的失敗。我在網上看到了很多例子,但我找不出什麼好的東西!
if(strtotime("22-04-17") < strtotime("04-05-17")){ //passing still the
// bigger on but not working
echo 'Date One is smaller than date two';
}
[比較兩個日期(的可能的複製https://stackoverflow.com/questions/3847736/comparing-two-dates ) – GrumpyCrouton
'strtotime'的默認格式是'Ymd' –
@GrumpyCrouton這實際上非常複雜。我只是試圖比較兩個日期。所以請給我一個更簡單的例子。 –