2017-02-10 77 views
0

我試圖在Yii2中比較datetime s到time s,同時使用今天的日期作爲基準。我得這一行,但我敢肯定它是不是這樣做的正確方法(和不工作):如何將時間與今天的日期進行比較?

$items = mtype::find()->select(["id"])->where(["<","last_run","from_unixtime(unix_timestamp(curdate())+unix_timestamp(concat('1970-01-01 ',time_format(curtime(),'%H:%i:00'))))"])->asArray()->all(); 
+0

你存儲「last_run」在timestemp? –

+0

$ items = mtype :: find() - > select([「id」]) - > where([「<」,「last_run」,time()] - > asArray() - > all(); –

+0

@YasinPatel:last_run是'datetime'。 – Exec

回答

相關問題