获得“约会”从数据库中输入并添加秒数
public function updateAuction($id)
{
$AuctionsTable = Doctrine_Core::getTable('auctions');
$auction = $AuctionsTable->find($id);
$auction->ends_at += 10;
$auction->save();
}
我正在使用 Doctrine 从数据库中获取记录。
我需要增加此记录的ends_at 列的秒数,该列是日期类型。
+=
当然不起作用。比方说,向ends_at 变量添加 10 秒的最快方法是什么?并处理了所有其他可能出现的麻烦(59 + 10 = 69 秒)。
也许我应该使用mysql的addtime()函数?但这是用 Doctrine 实现的吗?在学说上没有找到任何关于 addtime()
的内容。
public function updateAuction($id)
{
$AuctionsTable = Doctrine_Core::getTable('auctions');
$auction = $AuctionsTable->find($id);
$auction->ends_at += 10;
$auction->save();
}
I'm using Doctrine to get a record from the database.
I need to increase number of seconds on this records ends_at column, which is a date type.
+=
of course didn't work. What is the quickest way to add, let's say, 10 seconds to ends_at variable? And having handled all the other nuisances that might appear (59 + 10 = 69 seconds).
Perhaps I should use mysql's addtime()
function? But is that implemented with Doctrine? Didn't find anything about addtime()
on doctrine.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
try this: