【发布时间】:2016-01-08 09:53:20
【问题描述】:
我在 php/mysql 中有以下查询:
$q2 = $conn3->prepare("SELECT (t.start_time + INTERVAL t.text_duration SECOND) as end_time FROM texts t WHERE t.start_time <= :starttime AND (t.start_time + INTERVAL t.text_duration SECOND) >= :starttime AND t.plot_id = :plot_id LIMIT 1");
$q2->bindValue(':starttime', $start_timestamp);
$q2->bindValue(':plot_id', $plot_id);
$q2->execute();
$check2 = $q2->fetch(PDO::FETCH_ASSOC);
$start_time是一个日期时间对象,定义如下:
$date = new DateTime();
$start_timestamp = $date->add(DateInterval::createFromDateString('10 minutes'));
当我运行它时,我收到以下错误:
Catchable fatal error: Object of class DateTime could not be converted to string in ...
我该如何解决?
【问题讨论】:
标签: php mysql datetime date-arithmetic