PHP How to compare date and date?

前端 未结 2 401
独厮守ぢ
独厮守ぢ 2021-01-16 09:31

I have this value from database:

\'2009-1-1 00:00:00\', okay, let me paste my code:

$fetch = mysql_fetch_assoc($result);
$db_value = $fetch[\'date\']         


        
相关标签:
2条回答
  • 2021-01-16 10:18

    You should use the second one, because your db result is a string so it can't be used like that.

    0 讨论(0)
  • 2021-01-16 10:31

    Probably , you can get the epoch value of the date using mktime function , then you could

    compare the date's times stamp values easily . before that you parse first date string

    into year, month , day , hours, minutes , seconds. then use mktime function

    0 讨论(0)
提交回复
热议问题