comparing date and time php

前端 未结 2 1540
说谎
说谎 2021-01-21 09:16

i need to compare two dates where if one date is greater than the other then an sql will run. this is my code

date_default_timezone_set(\'Asia/Kuala_Lumpur\');
$         


        
相关标签:
2条回答
  • 2021-01-21 09:31

    try this,

     date("Y-m-d", strtotime($date)) >  date("Y-m-d", strtotime($duedate))
    
    0 讨论(0)
  • 2021-01-21 09:34

    could you try and use the date format before using strtotime

    $duedate = $row['payment_due'];
    $duedate = $duedate->format('Y-m-d G:i:s');
    
    0 讨论(0)
提交回复
热议问题