2017-02-10 132 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

回答

相关问题